You can use the try function to prevent the json functions from failing the query. For example, SELECT try(json_parse('bad json')) will return null instead of failing the query.
try
SELECT try(json_parse('bad json'))
null