How to use libjson in cocos2d-x?

How can I use libjson to decode a CCArray or CCDictionary???

CCArray’s elements and CCDictionary’s values are CCObject*, so I think you can only encode/decode CCString easily.
Of course you can do serialization of all CCObject with json format , e.g. serialize CCSprite, CCLayer, but a hard job would be required.

Thank u very muchBut,is there any other easier way to do decode and encode in cocos2d-x?
Walzer Wang wrote:

CCArray’s elements and CCDictionary’s values are CCObject*, so I think you can only encode/decode CCString easily.
Of course you can do serialization of all CCObject with json format , e.g. serialize CCSprite, CCLayer, but a hard job would be required.

For my last project I implemented a simple dict2json and json2dict function to encode/decode dictionaries containing only arrays and strings (and numbers and bools) with libjson to do some network calls. It’s pretty straightforward - if you’re interested in the code, I could upload it to github.

If so, then I will be very grateful!!
Christian Rothe wrote:

For my last project I implemented a simple dict2json and json2dict function to encode/decode dictionaries containing only arrays and strings (and numbers and bools) with libjson to do some network calls. It’s pretty straightforward - if you’re interested in the code, I could upload it to github.