Skip to content

Latest commit

 

History

History
22 lines (19 loc) · 523 Bytes

README.md

File metadata and controls

22 lines (19 loc) · 523 Bytes

Utility to flatten json into key = value pairs. It might be used to compare different json objects.

It accepts json as first cli attribute, or can read from stdin:

❯ echo '{"foo":"bar","baz":{"bar":1}}' | ./flatten
foo = bar
baz.bar = 1

Run go build -o flatten main.go to build binary.

For array values in json - multiple lines with the same key will be printed:

echo '{"foo":"bar","baz":{"bar":[1,2,3,4,5]}}' | flatten
foo = bar
baz.bar = 1
baz.bar = 2
baz.bar = 3
baz.bar = 4
baz.bar = 5