如何在android中删除json对象中的斜杠?

时间:2016-10-18 14:59:24

标签: android json android-studio

我无法删除j son对象中特定位置的斜杠。 如何删除j子对象之间的斜杠。在这里我会提到我的json

{
 "property": [
{
  "ad_detail": {
    "id": 15,
    "ad_id": "PFAS1015",
    "user_id": "1",
    "project": "chennai builders",
    "locality": "Pallikaranai",
    "city": "Chennai",
    "address": "Kamakshi colony",
    "landmark": "near mother matric school",
    "property_type": "apartment",
    "sale_type": "new",
    "description": "one of the best apartment near to pallikaranai",
    "validity_expire": "2016-11-17 12:11:14",
    "payment": "yes",
    "payment_details": "cash",
    "images": "",
    "videos": "",
    "booking_amount": "12",
    "total_cost": "20",
    "additional_cost": "02",
    "ad_status": "pending_verification",
    "ad_type": "sell",
    "ad_level": "premium",
    "num_views": "",
    "created_at": "2016-10-18 12:11:14",
    "updated_at": "2016-10-18 12:15:23"
  },
  "property_detail": {
    "id": 11,
    "user_id": "1",
    "ad_id": "PFAS1015",
    "ad_type": "sell",
    "bedrooms": "1bhk",
    "area": "1243",
    "area_unit": "sq_feet",
    "price": "",
    "negotiable": "Negotiable",
    "property_status": "readytomove",
    "property_age": "2",
    "possession_date": "2016-08-09 12:47:32",
    "furnishing": "semi_furni",
    "furnishings": "{\"wardrobe\":\"wardrobe\",\"bed\":\"bed\",\"ac\":\"ac\",\"tv\":\"tv\",\"sofa\":\"sofa\",\"fefrigerator\":\"fefrigerator\",\"dining_table\":\"dining_table\",\"washing_machine\":\"wa",
    "amenities": "{\"car_parking\":\"car_parking\",\"power_backup\":\"power_backup\",\"security\":\"security\",\"lift\":\"lift\",\"swimming_pool\":\"swimming_pool\"}",
    "preferred_tenants": "",
    "wardrobe": "3",
    "beds": "1",
    "ac": "1",
    "tv": "",
    "bathrooms": "3",
    "balconies": "4",
    "floorno": "21",
    "totalfloor": "3",
    "open_side": "1",
    "facing": "west",
    "facing_width": "100",
    "facing_width_unit": "feet",
    "additional_rooms": "{\"prayer_room\":\"prayer_room\",\"study_room\":\"study_r",
    "price_include": "{\"pic\":\"pi",
    "living_dining": "2",
    "kitchen": "4",
    "master_bedroom": "4",
    "bathroom": "3",
    "balcony": "4",
    "other_bedroom": "5",
    "overlooking": "road",
    "ownership_type": "leasehold",
    "covered": "2",
    "open": "2",
    "created_at": "2016-10-18 12:11:14",
    "updated_at": "2016-10-18 12:15:23"
  }
},
{
  "ad_detail": {
    "id": 17,
    "ad_id": "PFAS1017",
    "user_id": "1",
    "project": "checkpro",
    "locality": "Pallikaranai",
    "city": "Chennai",
    "address": "Kamakshi colony",
    "landmark": "near mother matric school",
    "property_type": "apartment",
    "sale_type": "new",
    "description": "gjnmghmjhgkhjk",
    "validity_expire": "2016-11-17 12:55:12",
    "payment": "",
    "payment_details": "",
    "images": "",
    "videos": "",
    "booking_amount": "",
    "total_cost": "20",
    "additional_cost": "",
    "ad_status": "pending_verification",
    "ad_type": "sell",
    "ad_level": "",
    "num_views": "",
    "created_at": "2016-10-18 12:55:12",
    "updated_at": "2016-10-18 12:55:12"
  },
  "property_detail": {
    "id": 13,
    "user_id": "1",
    "ad_id": "PFAS1017",
    "ad_type": "sell",
    "bedrooms": "fcdxvgdxc",
    "area": "243",
    "area_unit": "meter",
    "price": "",
    "negotiable": "",
    "property_status": "live",
    "property_age": "1",
    "possession_date": "2016-08-09 12:47:32",
    "furnishing": "furnished",
    "furnishings": "\"4\"",
    "amenities": "\"2\"",
    "preferred_tenants": "",
    "wardrobe": "3",
    "beds": "6",
    "ac": "5",
    "tv": "2",
    "bathrooms": "3",
    "balconies": "4",
    "floorno": "21",
    "totalfloor": "3",
    "open_side": "12",
    "facing": "dffgdg",
    "facing_width": "234",
    "facing_width_unit": "sq.feet",
    "additional_rooms": "\"3\"",
    "price_include": "\"fdsfdsfds",
    "living_dining": "fghh",
    "kitchen": "fdgdfgd",
    "master_bedroom": "434",
    "bathroom": "fdgdf",
    "balcony": "dfsdfds",
    "other_bedroom": "dgdfgdsfg",
    "overlooking": "\"334\"",
    "ownership_type": "dsfgds",
    "covered": "dfsdfs",
    "open": "dsfds",
    "created_at": "2016-10-18 12:55:12",
    "updated_at": "2016-10-18 12:55:12"
  }
}
],
"message": "Success",
 "code": true
}

1 个答案:

答案 0 :(得分:1)

这应该做的工作

String newJson = oldJson.replaceAll("\\\\", "");