Make parse_json method in error handling