I have gone through How can I pretty-print JSON in (unix) shell script? and other Stackoverflow posts on "pretty print JSON" but they are only good for simple inputs like,
echo '{"foo": "lorem", "bar": "ipsum"}' | python -m json.tool
When I try to do something like this
echo '{"group" : {list : [1,2,3]}, "list" : ["a","b","c"]}' | python -m json.tool
it fails.
Gives me the error
Expecting property name enclosed in double quotes: line 1 column 13 (char 12)
PS: Why am I trying to pass a complex json input? I'm trying to solve question 1 from here
Edit: Thanks for prompt reply. But what if I'm looking for an output like this
{
"group" : {
"list" : [1,2,3]
},
"list" : ["a","b","c"]
}