Hacker News new | ask | show | jobs
by polymonster 2381 days ago
This project came about because we were using json a lot for it’s for simplicity and also widespread support in languages and tools we were using.

We started hand editing a lot and making more mistakes, but we have a lot of code generated json from build pipelines and use json with a number of different libraries in different tools already so didn’t really want to switch to yaml or toml.

Jsn is not meant to replace json, we are still using json a lot natively, we just can write config files more easily and jsn spits out fully compliant json for you, or you can use a python dict the same as json.

Jsn does not have a serializer, once it has been parsed it is json.

2 comments

JSON to YAML is super easy, and back too. That's what we do here. YAML+comments is generated by humans, conver to JSON, merged with JSON made by machines into final JSON configs used by loads of apps. And dumping the whole thing, or parts back out to YAML is trivial.
Yeah, in hindsight maybe we could just switch to YAML but it does have quite a lot more syntax.

Jsn started as a python function which removed comments and fixed trailing commas. YAML does not come bundled with python and is an external dependency..

I suppose looking at it now jsn grew to a point where using something else in the first place would have been less work :)

Thank you for acknowledging that YAML could have been an alternative choice. But don't let such alternatives stop you from hacking your own solution or scratching your itch. If every person on the earth, stopped developing their own solution because there is an alternative that works with limitations we will see no progress in technology. It is good to develop your solution and then come to the conclusion that there is a better alternative than not having tried at all.
Does Jsn provide extra features over Jsonnet or Cuelang?
I suppose not. Jsn has some unique features that have just developed over time, starting as json with comments and no need for quotes.

Jsonnet looks pretty comprehensive and I did not know about it!