Use the search API instead, and set a category_filter
according to this list.
This should give you all the "objects" in the given category.
Something like this http://api.yelp.com/v2/search?category_filter=restaurants
.
Update
It seems like I misunderstood a little... so you want to get the root category.
(eg. for "italian"–>"restaurants", "french"->restaurants, "car dealers"->automotive etc.)
I think you have two options:
- Hardcode the dictionary of all restaurant subcategories (french,italian...) into a file (plist, json, whatever) and after getting the "object" you could check if the subcategory is included in the hard-coded subcategories dictionary.
- Use the search API and provide the bussiness
id
andcategory_filter
set to restaurants and check if it returns any result - if not, then the object is not in the right category.
The reason why I am suggesting to hard code it is, because Yelp doesn't provide an API to get complete list of categories.
In my opinion I would try the approach #1, because it is less intensive on the network side and a dictionary is blazing fast.
But to answer your initial question, no it is not possible to have the root category in the JSON file.