×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Adam Bedell
Added: Sep 13, 2013 4:30 AM
Views: 1783
Tags: no tags
  1. IT(KTestFormatedJson, "{\"responseData\": {\"translatedText\":\"אני ילד\"}, \"responseDetails\": null, \"responseStatus\": 200}");
  2.  
  3. CJsonBuilder* jsonBuilder = CJsonBuilder::NewL();
  4. // this will create json string representation in memory
  5. jsonBuilder->BuildFromJsonStringL(iKTestFormatedJson);
  6.  
  7. CJsonObject* rootObject;
  8. CJsonObject* textObj;
  9. jsonBuilder->GetDocumentObject(rootObject);
  10.  
  11. if(rootObject)
  12.         {
  13.         TBuf<256> message;
  14.         rootObject->GetObjectL(_L("responseData"),textObj);
  15.         textObj->GetStringL(_L("translatedText"),message);
  16.         }
  17.  
  18. // we need manually release created object
  19. delete rootObject;
  20.  
  21. // releases only jsonBuilder object, not objects which was created by him
  22. delete jsonBuilder;