skip to Main Content

Json – JQ – Groupby and concatenate text objects

Not quite getting it. I can produce multiple lines but cannot get multiple entries to combine. Looking to take Source JSON and output to CSV as shown: Source JSON: [{"State": "NewYork","Drivers": [ {"Car": "Jetta","Users": [{"Name": "Steve","Details": {"Location": "Home","Time": "9a-7p"}}]}, {"Car":…

VIEW QUESTION

Sorting a JSON file by outer object name

I have a json file input.json thus: { "foo":{ "prefix":"abc", "body":[1,2,3] }, "bar":{ "prefix":"def", "body":[4,5,6] } } I would like to sort it by the outer object names, with "bar" coming before "foo" in alphabetical order like so: { "bar":{…

VIEW QUESTION

Json – Update fields from string in JQ

I have a bash $string containing the values: abc,def and a file.json looking like this: [ { "loc": "51.12345, 12.12345", "city": "CityName1" }, { "loc": "65.12345, 15.12345", "city": "CityName2" } ] I'm trying to update the city field with the…

VIEW QUESTION

Json – JQ adding count of nested array objects to CSV

Working with a nested arrays like this: [ { "value1": "Data1-0", "value2": "Data2-0", "nArray": [ {"nValue1": "nData1-0a","nValue2": "nData2-0a"}, {"nValue1": "nData1-0b","nValue2": "nData2-0a"}, {"nValue1": "nData1-0c","nValue2": "nData2-0a"} ], "value3": "Data3-0" }, { "value1": "Data1-1", "value2": "Data2-1", "nArray": [ {"nValue1": "nData1-1a","nValue2": "nData2-1a"}, {"nValue1": "nData1-1b","nValue2":…

VIEW QUESTION
Back To Top
Search