Skip to main content

I honestly still cant believe they actually updated the spec to allow comments but we really did it and configuration files everywhere are going to be so much easier to read now. It felt like shouting into the void for a while there so thank you for sticking with this …

January 21, 2013

Allow Comments in JSON

Allow Comments in JSON

🏆 Won — 229 supporters Verified

Final supporters

B
Bernhard v.
L
Legend L.
A
Alexander
D
David R.
R
Ronny H.
A
Alan L.
S
Someone
M
Michael W.
S
Someone
J
jorge l.
+219 more
Started by Anonymous 14 years, 9 months ago
What: We, the undersigned, request that the ECMA-262 5.x Editions (the specification for ECMAScript (also known as "JavaScript", including JSON Grammar)) specifically allow comments in JSON such that JSON validators must not fail an input file because it has comments in it.


Use-case: Validation of configuration files done in JSON with comments should succeed, but currently does not.


Why: Since JSON is frequently used for configuration files, as distinguished from bulk data transport, allowing comments in JSON will greatly ease development and configuration tasks. Additionally, securely stripping out comments when required is not a difficult task and is supported by many tools.

Updates

July 1, 2012

I was just looking at a massive stack of config files and honestly the sheer amount of frustration people have with this spec is wild. Someone sent me a message about how their entire build pipeline crashed because of a trailing comment and I just thought yes exactly that is why this needs to change.

14 Comments

L
Legend Length
10 years ago Featured

Funny that the main reason the author of JSON wanted to get rid of comments was because people might abuse them by adding annotations etc.. Yet the solution is to simply demand comments get stripped and discarded.

M
Martin Berends
12 years ago Featured

I would be happy if the MAY became SHOULD in "A JSON decoder MAY accept and ignore comments". (https://groups.yahoo.com/neo/groups/json/conversations/topics/152)

T
Tom Reynolds
14 years ago Featured

its 2016 and we are still arguing about human readable comments? come on.

M
Mark Pearce
14 years ago Featured

Honestly having to use a separate pre-processor just to keep notes in a config file is a pain. JSON is standard for configs now so just update the spec.

D
David Okafor
14 years ago Featured

I end up using json5 anyway because standard json is too restrictive for my dev team. Would be nice if the base spec caught up with how people actually write code.

S
Sarah Ingram
14 years ago Featured

WHY IS THIS SO HARD. Just add it already.

A
Alexander
10 years ago

Comments = whitespace.

D
David Raymond
10 years ago

Without comments, json config files are pretty unworkable.