I searched for about two hours, and it seems that someone has no clear explanation of how to read the JSON file in Objective-C .
Let's say I have a JSON file called colors.json
that looks like this:
{ "colors": [{ "name": "green", "pictures": [{ "pic": "pic1.png", "name": "green1" }, { "pic": "pic2.png", "name": "green2" }] }, { "name": "yellow", "pictures": [{ "pic": "pic3.png", "name": "yellow1" }] }] }
Where can I copy this file to my Xcode path?
How can I get this file programmatically?
After this file - How do I find out the name
value for each colors
object?
How would I say "for each image in a color named green
, get the name
value in NSString"?
I tried several methods, but have not yet come to a conclusion. Am I just misunderstanding the concept of JSON?
source share