Search code examples
jsonparse-platformquoting

Parse.com says "invalid character '\'' looking for beginning of value"


When I click finish import, Parse.com says "invalid character '\'' looking for beginning of value". However, there is not a single character "\" in my entire file. You can check it below.

Apparently, this is because of using single quotes instead of double quotes. Can I use "name": 'Samat', instead of "name": "Samat"?

https://gist.github.com/samatdav/61db29a676da21dc4bbd


Solution

  • The JSON format specification is very clear about this: String values must be enclosed in double quotes. Single quotes or unquoted values (other than true, false, null, numbers or nested object/array definitions) are not allowed.

    JavaScript's internal object notation is much less strict in that regard, as it generally allows single-quoted strings. However, JSON is only a subset of the original JavaScript object notation syntax.