Parse json file in cocos2dx
I am working on cocos2d-x project, I will be using my iOS and Android code. Now I am using a json file to store unlock data, but I don't know how to parse the data in cocos2dx. can i get a quick guide (demo code) so i can continue my project.
I created a json file and saved the data in it. I put the demo inside a json file.
{
"id": "food",
"name": "cherry",
"price": "20 coins",
"unlock": {
"level": 15,
"advance_unlock_price": "200 coins"
}
}
+3
source to share
2 answers
You can use quickjson which is part of Cocos2d-x.
Using Rapidjson in Cocos2D-X: Generating a JSON Document in Code and Batch Production
+4
source to share