3 ms·
If I need to grok a complex nested data structure then YAML is a 'mare, but JSON is not much better - even with nice IDE support. TBH end up just running a scri
by tragomaskhalos 3y ago
If I need to grok a complex nested data structure then YAML is a 'mare, but JSON is not much better - even with nice IDE support. TBH end up just running a script to flatten the whole lot into lines of key-value pairs, where each key is.the.full.path.from.root, with numbers for array indices - NOW I can see what's going on. I believe this is similar to how TOML is structured, albeit people criticise it for being too verbose as a result!
- PhilippGille 3y agoFor anyone looking for such a script, there's some CLIs that make it easy. One is `yq -o props` [1], another way is to use `yq -j` or `yj` [2] to convert to JSON and pipe it to `gron` [3]. [1] https://github.com/mikefarah/yq https://github.com/mikefarah/yq [2] https://github.com/sclevine/yj https://github.com/sclevine/yj [3] https://github.com/tomnomnom/gron https://github.com/tomnomnom/gron
- verdverm 3y agohttp://www.youtube.com/watch?v=XNBqBWO4y08 http://www.youtube.com/watch?v=XNBqBWO4y08 This shows a TUI I've been working on to grok, munge, and ETL config. It leverages CUE, but it's not required