r/ProgrammerHumor • • 10d ago • Bravo 1

Meme commentsInJson

Post image
6.0k Upvotes

202 comments sorted by

View all comments

Show parent comment

1

u/Turbulent_Stick1445 9d ago

JSON has optional indenting where the tab is just generic white space you can use without it impacting anything. You do not need to indent something in JSON, and it's only meaningful to human readers if you do.

However, tabs ARE meaningful in YAML, under certain circumstances they affect how the file is parsed.

1

u/FerusGrim 9d ago

What the person was saying is that JSON doesn’t “have” optional indentation. It’s just meaningless, and ignored.

1

u/Turbulent_Stick1445 9d ago

OK, I'm still unsure what was read in my original comment that the GGP was generating a warning message.

Point was simply if you indent lines of JSON with tabs, you're going to run into trouble if parsing it with a YAML parser. Whether JSON considers indenting to be significant is really irrelevant to that point, people indent JSON just as they indent Java, C, etc. I never wrote anything that I feel can be remotely interpreted as "If you indent JSON, JSON will consider the indenting to be significant and interpret it differently" but maybe you're seeing something there?

1

u/FerusGrim 9d ago

I don't think you're being misunderstood. I, and I'm pretty sure everyone else, already knows what you mean. It may be a bit pedantic, but the point being made is just that the way you were referring to using indentation was as if it was some property that JSON had, or was capable of. That's why I used "have" in quotes. But JSON doesn't really "have" the "feature" of indentation, it's just... uncaring of it.