added try catch block around json parse