Simple quotes are allowed in JSON?

4

Can I represent a JSON object in this way?

{
    'helloWorld': true
}
    
asked by anonymous 10.03.2017 / 18:51

2 answers

3

The JSON format specification clearly states that only double quotation marks can be used, more specifically U+0022 .

    
10.03.2017 / 19:35
4

No, only double quotes are allowed in JSON. The example question generates an invalid object, as can be tested on the link: link

The right thing would be:

{
    "helloWorld": true
}

Note that the property name is required to be enclosed in double quotation marks, so the following notation is also invalid:

{
    helloWorld: true
}
    
10.03.2017 / 18:53