Whenever I have a Json string object with a space in it, I get the following error.
Java:
String jString = getResources().getString(R.string.event); JSONObject object = new JSONObject(jString);
Json:
<resources> <string name="event"> {"Array":[{"Name":"One two three"},{"Name":"Two"},{"Name":"Three"}]} </string> </resources>
The following message appears:
09-06 22:35:08.214: WARN/System.err(1079): org.json.JSONException: Unterminated object at character 21 of {Array:[{Name:One two three},{Name:Two},{Name:Three}]}
This has no problems:
<resources> <string name="event"> {"Array":[{"Name":"One"},{"Name":"Two"},{"Name":"Three"}]} </string> </resources>
Am I quoting something wrong?
EDIT: After reading my own post, I noticed that the error message does not contain quotes around the values ​​of string objects. So I changed the "to" in the xml line and worked fine. Any idea how to do this does not remove quotes?
source share