in reply to Re: Outputting JSON with sorted names/keys
in thread Outputting JSON with sorted names/keys

ooh. jq looks interesting. If I start doing more with JSON, I'll probably want to play with that, because a structure-aware sed-like tool would be quite useful.

  • Comment on Re^2: Outputting JSON with sorted names/keys

Replies are listed 'Best First'.
Re^3: Outputting JSON with sorted names/keys
by Fletch (Bishop) on Jan 27, 2020 at 17:12 UTC

    I usually plug jq as being like "awk for JSON data" (in that just I think of it more in terms of doing "awk-y" things with it than sed like things (e.g. I want to pull these "fields" (some set of keys from an object) out of each line (each textual line of the file being a JSON object)).

    At any rate seconding it as a highly recommended useful thing to have lying around on your PATH somewhere. Check out the @csv and @sh formatting modifiers which can be handy wrangling JSON from the command line (search for "Format strings and escaping" in the manual).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.