Home » Community » Newbie corner » Deserialize json object
Deserialize json object [message #40759] |
Fri, 13 September 2013 13:11 |
andreicpp
Messages: 2 Registered: September 2013 Location: Romania
|
Junior Member |
|
|
Hello,
I am receiving via httprequest a json object which I put in a String.
This is how it looks:
sResponse={"response":{"username":"andrei","role":"user ","firstName":"andrei","lastName":"nume","email":"andrei@gmail.com","id":2,"password":"1234"},"status":{"description":[], "status":"OK"}}
How can I deserialize it and put it in an object of class
class Response {
Username usr;
Response response;
}
I tried implementing jsonize method in this class Response, and than use loadfromjson, but no positive results.
Can someone help me?
Thank you
|
|
|
|
Re: Deserialize json object [message #40849 is a reply to message #40825] |
Mon, 23 September 2013 10:23 |
andreicpp
Messages: 2 Registered: September 2013 Location: Romania
|
Junior Member |
|
|
Thanks a lot
I wrote a method included in the class:
void HTTPResponseUser::LoadFromJson(Value json){
m_User.LoadFromJson(json["response"]);
m_status.LoadFromJson(json["status"]);
}
|
|
|
Goto Forum:
Current Time: Tue Jan 21 10:27:06 CET 2025
Total time taken to generate the page: 0.02085 seconds
|