Use jq to Format Certain Fields as Compact?
问题 Is jq the best choice for pretty-printing arbitrary JSON? cat my.json | jq . pretty-prints the given JSON, but expands every field on a separate line. But what if some of the fields are repetitive, such as a list of points? How can fields that match a pattern be formatted on a single line with --compact-output ? For example, format "coords" and "list" fields below on a single line: [ { "field1": { "a": "", "b": "" "list": [{ "name": "x", "score": 1, "rect": { "x": 156, "y": 245, "w": 35, "h":