Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

gin0606/cocos2d-x-extention-CCJson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

[DEPRECATED]cocos2d-x-extention-CCJson

json string convert to CCDictionary

  • object : CCDictionary
  • array : CCArray
  • string : CCString
  • number : CCFloat
  • true/false : CCBool
  • null : NULL

Usage

{
    "stringKey": "JSON_string",
    "numberKey": 111,
    "falseKey": false,
    "trueKey": true,
    "arrayKey": [
        "one",
        "two",
        "three"
    ],
    "objectKey": {
        "objects": "o"
    }
}

CCDictionary *pDictionary = CCJson::JSONObjectWithString(jsonString);

CCString *ccString = (CCString *) pDictionary->objectForKey("stringKey");
ccString->getCString(); // => "JSON_string"

CCFloat *ccFloat = (CCFloat *) pDictionary->objectForKey("numberKey");

CCBool *ccBoolFalse = (CCBool *) pDictionary->objectForKey("falseKey");
ccBoolFalse->getValue(); // => false

CCBool *ccBoolTrue = (CCBool *) pDictionary->objectForKey("trueKey");
ccBoolTrue->getValue(); // => true

CCArray *ccArray = (CCArray *) pDictionary->objectForKey("arrayKey");
ccArray->count() // -> 3

About

json string convert to CCDictionary @ 2.1rc0-x-2.1.4

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages