Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Deserialize json object
Re: Deserialize json object [message #40825 is a reply to message #40759] Sat, 21 September 2013 19:04 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
There is no direct way how to do this "automatically". Usually, there is no need to store it in C++ structure too.

I usually do something like

Value r = ParseJSON(json_text)["response"];
r["username"]
r["email"]

Note that things are aranged so that failed ParseJSON returns empty Value and trying to access key in empty Value or missing key results in another empty Value (so the code above does not crash if json is invalid or keys are missing, just results in blanks..)

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: Build options
Next Topic: SortedIndex and Less
Goto Forum:
  


Current Time: Sun Jun 09 02:12:51 CEST 2024

Total time taken to generate the page: 0.01503 seconds