tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.23k stars 85 forks source link

Encode/decode JSON string #1980

Closed olorin37 closed 5 days ago

olorin37 commented 6 days ago

Stdlib should have functions for encoding object to JSON string and decoding it from string to the object. This is common practical need in configuration. (When as one field JSON string should be provided, regardles if outer format is also JSON or other, like YAML).

yannham commented 5 days ago

I think std.serialize and std.deserialize are what you're looking for. More specifically std.serializeJson {hello = "wolrd"}orstd.deserialize 'Json "{hello = \"world\"}"`

olorin37 commented 5 days ago

Right, I forgot about the function 🤦‍♂️, sorry for the noise:-)