I have the following json format. It's basically a representation of the calendar:
{"month1": {"day1":{...}, "day2": {...}}, "month2": {...}}
I'd like to sort it such that both the months and the days will be in numeric order. The below input is the output of jq -S
, but as you see it's sorted like: 1,10,2, and I'd like to sort it like 1,2,10. How can I do that with jq?
Input:
{"1":{"1":{"foo":"bar"},"10":{"foo":"bar"},"2":{"foo":"bar"}},"10":{"1":{"foo":"bar"},"10":{"foo":"bar"},"2":{"foo":"bar"}},"2":{"1":{"foo":"bar"},"10":{"foo":"bar"},"2":{"foo":"bar"}}}
Expected output:
{"1":{"1":{"foo":"bar"},"2":{"foo":"bar"},"10":{"foo":"bar"}},"2":{"1":{"foo":"bar"},"2":{"foo":"bar"},"10":{"foo":"bar"}},"10":{"1":{"foo":"bar"},"2":{"foo":"bar"},"10":{"foo":"bar"}}}