add `resource_to_json` helper