简体   繁体   English

如何从此json字符串中将大括号前的双引号删除

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

I found no particular solution for my json string. 我没有找到针对我的json字符串的特定解决方案。 I want to remove the double quotes from both end of the jsonObject. 我想从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: 如果您的JSON字符串格式相同,则可以使用以下代码获得所需的结果:

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: 您可以使用以下代码将字符串转换为JSON:

JSONObject jsonObject= new JSONObject(jsonString);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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