U++ framework
Do not panic. Ask here before giving up.

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: 14291
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: Tue Jun 23 06:37:01 GMT+2 2026

Total time taken to generate the page: 0.00533 seconds