Reputation: 144
i am working on cocos2d-x project i will use my code for ios and android both. Now i am using json file to store unlock data but i don't know how to parse the data in cocos2dx. can i have brief tutorial (demo code) so that i can proceed with my project.
i have created json file and save data in it. i put demo of inside json file.
{
"id": "food",
"name": "cherry",
"price": "20 coins",
"unlock": {
"level": 15,
"advance_unlock_price": "200 coins"
}
}
Upvotes: 3
Views: 6857
Reputation: 2778
Use rapid json if your game has big big scale otherwise you can use jsonccp it is lightweight but not good as compared to rapidjson.rapidjson more fast than any parser.
rapid json:
jsoncpp: https://github.com/open-source-parsers/jsoncpp
Upvotes: 2
Reputation: 13999
You can use rapidjson that is a part of Cocos2d-x.
Using Rapidjson in Cocos2D-X: Creating a JSON Document in Code and Serializing it
Upvotes: 4