I have a JSON object, which contains only strings and other objects:
{
"key1": "value1",
"key2": "value2",
"key3": {
"subKey1":"value3",
"subKey2":"value4"
}
}
I want to convert it to an array of strings by flattening the structure
[
"key1.value1",
"key2.value2",
"key3.subKey1.value3",
"key3.subKey2.value4",
]
I'm rather new to jq syntax and so far I managed to achieve only this with help of
to_entries | map([.key, .value | if type == "object" then type else . end]|join("."))
then I obtain
[
"key1.value1",
"key2.value2",
"key3.object"
]