Catch errors in json parsing