5 ms·
will never cause problems since we're not evaluating those as Javascript anyway A lot of JSON libraries, e.g. json_decode in PHP, refuse to parse JSON without
by pak 16y ago
will never cause problems since we're not evaluating those as Javascript anyway
A lot of JSON libraries, e.g. json_decode in PHP, refuse to parse JSON without double-quoted keys. I'm actually curious what you are using to parse it (that isn't running on JavaScript) that allows such things. I don't know the details of your API, but is this an object that you intended to be passed to a jQuery method that re-encodes it with JSON.stringify before sending it to your API?
- JoelSutherland 16y agoIn face of the downvotes, I should clarify that this isn't a decision at the API level! The API requires JSON, valid JSON, of course. The templates operate against the API, delivering it valid JSON. Just like you can write an object literal in Javascript without quoted strings, you can in our templates as well. The JS library uses JSON.stringify before sending it to the API. The depth of my preference to omit quotes on keys when allowed extends no deeper than this blog post. I am sure Kris will regret having me format it for him.