简体   繁体   中英

Error in parsing json data

I have this json data.I want to parse it.I am getting error when I am trying to do

JsonObject json=new JsonObject(x);

Because it contains white spaces.

{id=11, note=A sample note,}

Please help me to solve it.

To make your example a valid JSON wrap the properties and values in double quotes, remove the last comma and replace your equal sign with colon.

The result will look like this:

{
    "id": "11",
    "note": "A sample note"
}

You Have to keep in mind two things:

1) Check If The JSON Format Is Right:

The JSON Format Of your Data Should Be like This .

2) Check That Your Code is Correct:

Visit This Website for Code.

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