I have a JSON Object. I need to add another key-value pair to the JSON Object. The key which is going to get appended will have values with double quotes and other special characters such as :
{"cov_details":[{"issue_date":"UNIT ,NEW JERSEY","cov":"MCWG"}],"dl_number":"NYC100000784","address":" KO VIRUDHACHALAM TK","issue_date":"24-12-2010","dob":"21-03-1971","name":"VICNESWARAN S","blood_group":"","validity":{"transport":"","non-transport":"24-03-2010 to 23-03-2030"},"father/husband":"Tim"}
But whenever I try to add this string to the code
either by just adding them as a string like this :
jsonObject.put("result", Modified_Result); //Newresult is the string with the above string value
Or by converting that String to an object and then appending it to the JSON Object like this :
Object Modified_Result= NewResult;// Newresult is the string with the above string value
jsonObject.put("result", Modified_Result);
I get the same output which is
{"result":"{"cov_details":[{"issue_date":"UNIT ,NEW
JERSEY","cov":"MCWG"}],"dl_number":"NYC100000784","address":KO VIRUDHACHALAM
TK","issue_date":"24-12-2010","dob":"21-03-1971","name":"VICNESWARAN
S","blood_group":"","validity":{"transport":"","non-transport":"24-03-2010 to 23-03-
2030"},"father\/husband":"Tim"}","status-code":"101","request_id":"a2642ae9-2f10-4e9a-9f7e-c3ee1a9a2dbe"}
Note the string ,"status-code":"101","request_id":"a2642ae9-2f10-4e9a-9f7e-c3ee1a9a2dbe"} is already present in the JSON Object and it remains unaffected. The problem seems to occur whenever I add a new string with double quotes.
Can you tell me how can I get an output with no backward slashes before special characters ?