interstar
interstar

Reputation: 27236

What's wrong with this JSON object?

What's wrong with this?

{ 'z': 'hello' }

Looks like a valid JavaScript dictionary to me, but both Python JSON and http://pro.jsonlint.com/ are telling me

Parse error on line 1:
{    'z': 'hello'}
-----^
Expecting 'STRING', '}'

What am I doing wrong?

Upvotes: 1

Views: 101

Answers (1)

Luciano Ramalho
Luciano Ramalho

Reputation: 2021

Strings must be delimited by double quotes in JSON: http://www.json.org/

They can be single quoted in Python and JavaScript, but JSON is a very small subset of JavaScript.

Upvotes: 10

Related Questions