Parsing double quotation marks with JSON

Parse a JSON data:

{“manifest”:{ Version:“3.0”}}

If you look carefully, this string is not in the normal JSON format. Version lacks double quotation marks. It should be:

{“manifest”:{ “Version”: “3.0”}}

Reprinted: https://www.cnblogs.com/afluy/p/4023838.html

If used

JSONObject mainfestObject.getJSONObject (“manifest”);

This method analysis will report an error, but if you use

String mainfestStr = object.optString (“manifest”, “”);

JSONObject mainfestObject = new JSONObject(mainfestStr);

The above method is successful!


Read More: