Implement a compat version of json_type_to_name.