Editied script to produce properly formated JSON and reproduced JSON in proper format