Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 991
Samat Davletshin Avatar asked Oct 16 '25 10:10

Samat Davletshin


2 Answers

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.

like image 174
Wormbo Avatar answered Oct 19 '25 00:10

Wormbo


For anyone that might need this later. As ipfs daemon --help suggests, the cors domain can be set via

>ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'

which in Windows yields

Error: failed to unmarshal json. invalid character '\'' looking for beginning of value

The correct version should be

>ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"

like image 42
SirPhemmiey Avatar answered Oct 19 '25 01:10

SirPhemmiey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!