简体   繁体   中英

How to remove this double quote before curly braces from this json string

I found no particular solution for my json string. I want to remove the double quotes from both end of the jsonObject. For better understanding I am sharing you the screenshot.

在此处输入图片说明 Thanks in Advance

If your JSON string format is the same you can use the following code to get your desired result:

jsonString = jsonString.replaceAll("(\"\\{\")","\\{\"").replaceAll("(\"\\}\")","\"\\}");

It simply removes all the leading and trailing double quotes from every array element.

You can convert your string into JSON using the following code:

JSONObject jsonObject= new JSONObject(jsonString);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM