Modifed script to parse json