Live data from Hacker News

JSON5 Data Interchange Format

json5.org

81–90 of 157 posts

Re: JSON5 Data Interchange Format

#81
post #79

Earlier quoted context omitted.

That was their point, you inevitably have to escape one or the other, so just pick one

My only disagreement is that you imply that this is no better than plain old JSON – I think it's positively _worse_. It makes it difficult to remember which of the two quote marks to escape, without checking the beginning of the string to see what quote marks were there (and this difficulty exists not only for humans but for machines, which introduces more complexity in parsers). The benefit of JSON is that it's simp…

I didn't imply that, in fact my comment agrees with what you are saying. Did you reply to the wrong person?

Re: JSON5 Data Interchange Format

#83
post #57

Earlier quoted context omitted.

It allows you to put double quotes in the string without escaping them, which is pretty nice.

But then you can't include single quotes into the string any more. Same problem again. The most practical solution for this problem I saw was in F#. You can use tripple-quoted strings. let a = """The diner is called "John's", but you can't let the string end with a double quote""" https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...

[deleted]

Re: JSON5 Data Interchange Format

#84
post #79

Earlier quoted context omitted.

My only disagreement is that you imply that this is no better than plain old JSON – I think it's positively _worse_. It makes it difficult to remember which of the two quote marks to escape, without checking the beginning of the string to see what quote marks were there (and this difficulty exists not only for humans but for machines, which introduces more complexity in parsers). The benefit of JSON is that it's simp…

I didn't imply that, in fact my comment agrees with what you are saying. Did you reply to the wrong person?

Haha, I only meant that as a "I agree with you, but I'd go even further" preface. In hindsight, this being HN, I should have been more precise!

Re: JSON5 Data Interchange Format

#85
Regardless of how good this is or not, every time it pops up I just wonder if anybody actually gives a crap or not.

JSON is one of those formats that's "good enough" even if it's stinky and it's also universally accepted that a small iteration on it with small conveniences doesn't make that much sense imho.

Re: JSON5 Data Interchange Format

#87
post #51

Earlier quoted context omitted.

It allows you to put double quotes in the string without escaping them, which is pretty nice.

An annoying half-solution that breaks down as soon as you encounter content with both. Better imho to have one way and become good at it. I think I might even prefer trailing commas to be mandatory.

It solves the problem like 99% of the time in my experience. It's very rare that I have content with both single and double quotes.

Re: JSON5 Data Interchange Format

#90
post #23

Earlier quoted context omitted.

It would lose its "backwards compatible" property though.

Having a defined, predictable behaviour in JSON5 doesn't seem like it would break backwards compatibility with JSON's undefined, unpredictable behaviour. I don't think someone with an existing JSON document would complain that a JSON5 parser behaved "too predictably" when interpreting their document.

It could change, and therefore break, the real-world behavior of a given parser that some code is knowingly or unknowingly relying on.
Post reply on HN