I have a legacy cli tool which outputs a structured list with sub-items intended with a tab
(stackoverflow won't let me put tabs here so I replaced them with 4 spaces in this example).
Heading One:
Sub One: 'Value 1'
Sub Two: 'Value 2'
Heading Two:
Sub Three: 'Value 3'
Sub Four: 'Value 4'
Key One: 'This key has no heading'
I try to achieve an JSON output like
{
"Heading One": {
"Sub One": "Value 1",
"Sub Two": "Value 2"
},
"Heading Two": {
"Sub Three": "Value 3",
"Sub Four": "Value 4"
},
"Key One": "This key has no heading"
}
Is this possible with jq
or do I need to write a more complex python-script?