added try catch on invalid json