I've been searching around for about two hours now and it seems nobody has a clear explanation of how to read a JSON file in Objective C.
Let's say I have a JSON file called colors.json, looking 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 do I copy that file to in my XCode path?
How do I get this file programmatically?
After I have this file - How do I read the
namevalue for eachcolorsobject?How would I say "for each picture in the color with the name
green, get thenamevalue in a NSString"?
I've been trying a few methods but haven't reached a conclusion yet. Am I just understanding the concept of a JSON wrong?