Cannot parse JSON: unexpected token


#1

I’m using the ATOM plugin and can’t get my response markup error free. I finally pasted the response markup from the 100 tutorial and even that gives me the subject error. Here is what is in my file now (from tutorial). Can anyone tell me what the issue is? The error is on the example line.

responses:
200:
body:
application/json:
example: |
{
“data”: {
“id”: “SbBGk”,
“title”: “Stiff: The Curious Lives of Human Cadavers”,
“description”: null,
“datetime”: 1341533193,
“genre”: “science”,
“author”: “Mary Roach”,
“link”: “http://e-bookmobile.com/books/Stiff”,
},
“success”: true,
“status”: 200
}

thanks
michael


#2

Yaml is indentation-based, so maybe you didn’t indent the example?

responses:
  200:
    body: 
      application/json:
      example: |
        {
          "data": {
            "id": "SbBGk",
            "title": "Stiff: The Curious Lives of Human Cadavers",
            "description": null,
            "datetime": 1341533193,
            "genre": "science",
            "author": "Mary Roach",
            "link": "http://e-bookmobile.com/books/Stiff",
            
          },
          "success": true,
          "status": 200
        }

#3

It pasted here without indents but it was indented when I copied it. But I went to the YAML specs and I read that you had to use the space bar and I’m pretty sure I used tabs so I re-indented everything with the space bar and the error has gone away. Thanks, Peter.