Basic JSON syntax?

Jess picture Jess · Aug 22, 2013 · Viewed 7.6k times · Source

Here is part of

[
UserJSONImpl{
    "id"=26136358,
    "name"='BryanConnor',
    "screenName"='thewhyaxis',
    "location"='null',
    "description"='TheWhyAxisisacollectionofindepthwritingaboutthevisualizationsthatdeserveyourattention.',
    "isContributorsEnabled"=false,

I'm not too familiar with JSON syntax and I haven't found a source on the web that provides an introduction; when I try to parse each JSONObject in the JSONArray I get an error like

Expected a ',' or ']' at character 14

When I input into jsonlint:

Parse error on line 1:

[    UserJSONImpl{      
-----^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', ']'

What's wrong with my JSON?

Answer

paul trmbrth picture paul trmbrth · Aug 22, 2013
[
    {
        "UserJSONImpl": {
            "id": 26136358,
            "name": "BryanConnor",
            "screenName": "thewhyaxis",
            "location": null,
            "description": "TheWhyAxisisacollectionofindepthwritingaboutthevisualizationsthatdeserveyourattention.",
            "isContributorsEnabled": false
            }
    }
]

Following http://json.org/

  • [ elements ] with elements as value,
  • value as object,
  • object as { members },
  • members as pair
  • pair as string : value
  • value as object
  • ...