Using jq --stream -c
on the command line, I can format pretty JSON like this:
{
"object": {
"something": {
"key1": 123,
"key2": 456
},
"something_else": {
"key1": [
"value1",
"value2"
]
}
}
}
into this:
[["object","something","key1"],123]
[["object","something","key2"],456]
[["object","something","key2"]]
[["object","something_else","key1",0],"value1"]
[["object","something_else","key1",1],"value2"]
[["object","something_else","key1",1]]
[["object","something_else","key1"]]
[["object","something_else"]]
[["object"]]
I've looked through the Golang documentation for JSON but couldn't find anything similar. Is there such a function that I've missed?
More precisely I'd like to print the above JSON like so:
object.something.key1=123
object.something.key2=345
object.something_else.key1.0=value1
object.something_else.key1.1=value2