Live data from Hacker News

FracturedJson

github.com

21–30 of 173 posts

Re: FracturedJson

#21

This is pretty cool, but I hope it isn't used for human-readable config files. TOML/YAML are better options for that. Git diff also can be tricky with realignment, etc. I can see potential usefulness of this is in debug mode APIs, where somehow comments are sent as well and are rendered nicely. Especially useful in game dev jsons.

Yaml is the worst. Humans and LLMs alike get it wrong. I used to laugh at XML but Yaml made me look at XML wistfully.

Yaml - just say Norway

Re: FracturedJson

#22
post #6

Nice. And BTW, thanks for supporting comments - the reason given for keeping comments out of standard Json is silly ( "they would be used for parsing directives" ).

It's a pretty sensible policy, really. Corollary to Hyrum's Law - do not permit your API to have any behaviours, useful or otherwise, which someone might depend on but which aren't part of your design goals. For programmers in particular, who are sodding munchkins and cannot be trusted not to do something clever but unintended just because it solves a problem for them, that means aggressively hamstringing everything.…

> A flathead screwdriver should bend like rubber if someone tries to use it as a prybar.

Better not let me near your JSON files then. I pound in wall anchors with the bottom of my drill if my hammer is not within arms reach.

Re: FracturedJson

#23
post #6

Nice. And BTW, thanks for supporting comments - the reason given for keeping comments out of standard Json is silly ( "they would be used for parsing directives" ).

It's a pretty sensible policy, really. Corollary to Hyrum's Law - do not permit your API to have any behaviours, useful or otherwise, which someone might depend on but which aren't part of your design goals. For programmers in particular, who are sodding munchkins and cannot be trusted not to do something clever but unintended just because it solves a problem for them, that means aggressively hamstringing everything.…

> A flathead screwdriver should bend like rubber if someone tries to use it as a prybar.

While I admire his design goals, people will just work around it in a pinch by adding a "comment" or "_comment" or "_comment_${random_uuid}", simply because they want to do the job they need.

If your screwdriver bends like a rubber when prying, damn it, I'll just put a screw next to it, so it thinks it is used for driving screws and thus behaves correctly.

Re: FracturedJson

#26

This is pretty cool, but I hope it isn't used for human-readable config files. TOML/YAML are better options for that. Git diff also can be tricky with realignment, etc. I can see potential usefulness of this is in debug mode APIs, where somehow comments are sent as well and are rendered nicely. Especially useful in game dev jsons.

Yaml is the worst. Humans and LLMs alike get it wrong. I used to laugh at XML but Yaml made me look at XML wistfully. Yaml - just say Norway

The Norway issue is a bit blown out of proportion seeing as the country should really be a string `"no"` rather than the `no` value

Re: FracturedJson

#27

Earlier quoted context omitted.

Just say Norway to YAML.

This is a reference to YAML parsing the two letter ISO country code for Norway: country: no As equivalent to a boolean falsy value: country: false It is a relatively common source of problems. One solution is to escape the value: country: “no” More context: https://www.bram.us/2022/01/11/yaml-the-norway-problem/

We stopped having this problem over ten years ago when spec 1.1 was implemented. Why are people still harking on about it?

Re: FracturedJson

#28
While I wish JSON formally supported comments, it seems more sensible (compatible) to just nest them inside of a keyed list or object as strings.

  {
    foo: "bar",
    ans: 42,
    comments: {
      ans: "Douglas Adams"
    }
  }

Re: FracturedJson

#29
post #8

Nice. And BTW, thanks for supporting comments - the reason given for keeping comments out of standard Json is silly ( "they would be used for parsing directives" ).

Unrelated: why spaces inside the parentheses? It’s not the first time I see this, but this is incorrect!

JSON doesn't have parentheses, but it does have braces and brackets. The JSON spec specifically allows spaces.

> Insignificant whitespace is allowed before or after any token.

Re: FracturedJson

#30
post #27

Earlier quoted context omitted.

This is a reference to YAML parsing the two letter ISO country code for Norway: country: no As equivalent to a boolean falsy value: country: false It is a relatively common source of problems. One solution is to escape the value: country: “no” More context: https://www.bram.us/2022/01/11/yaml-the-norway-problem/

We stopped having this problem over ten years ago when spec 1.1 was implemented. Why are people still harking on about it?

Now add brackets and end-tags, I'll reconsider. ;)
Post reply on HN