Does jq
support case insensitive sorting?
for instance I have data.json
like this
[
{"title": "first", "description": "foo"},
{"title": "Second", "description": "bar"}
]
simple jq 'sort_by(.title)' data.json
returns
[
{"title": "Second", "description": "bar"},
{"title": "first", "description": "foo"}
]
CodePudding user response:
actually jq
has built-in filters ascii_downcase
and ascii_upcase
you can use like this jq 'sort_by(.title | ascii_downcase)' data.json
to get proper result.
[
{"title": "first", "description": "foo"},
{"title": "Second", "description": "bar"}
]