Clean up some logic/formatting in JSON module