Can I represent a JSON object in this way?
{
'helloWorld': true
}
Can I represent a JSON object in this way?
{
'helloWorld': true
}
The JSON format specification clearly states that only double quotation marks can be used, more specifically U+0022
.
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
}