4 ms·
Presumably JSMin removes optional quotes in object laterals, so it probably doesn't output valid JSON.
by DougBTX 13y ago
Presumably JSMin removes optional quotes in object laterals, so it probably doesn't output valid JSON.
- spellboots 13y agoThat would be a pretty big mistake for the author of both the JSON spec and JSMin to make? Maybe it is but it seems unlikely.
- reverius42 13y agoJSMin is not the right tool for this. I'm sure it conforms to the JavaScript (ECMAScript) spec but probably not the JSON spec. Here's a trivial JavaScript function to convert JSON5 to regular JSON with no comments and quoted identifiers and all that good stuff: function JSON5_to_JSON(str) { return JSON5.parse(str).stringify(); } This is exactly what is suggested in the Usage section of the linked article.
- spellboots 13y agoIf the author of the JSON spec and JSMin says it's the right tool for the job, I am inclined to trust him on that barring further evidence that it is not...
- reverius42 13y agoSince when does Crockford say that JSMin is the right tool for this particular job: translating JSON5 into regular JSON?