Function and command-line option for sorting JSON object fields