Hello,
I have this json string : { "a": 10, "b": { "c": "AZERTY", "d": "QWERTY" } }
Without struct or C++ class, I want to get b's value as std::string. I
tried :
#include <iostream>
#include <fstream>
#include <cxxtools/jsondeserializer.h>
int main()
{
std::string s("{ \"a\": 10, \"b\": { \"c\": \"AZERTY\", \"d\":
\"QWERTY\" } }");
std::stringstream is(s);
cxxtools::JsonDeserializer deserializer(is);
cxxtools::SerializationInfo si;
deserializer.deserialize(si, "b");
std::string b1;
si.getMember("c") >>= b1; // ----> OK :)
std::cout << "b1: " << b1 << std::endl;
std::string b2;
deserializer.deserialize(b2, "b"); // ----> NOT OK, b2 is empty :(
std::cout << "b2: " << b2 << std::endl;
}
Is it possible to get b's value as string ?
Thanks,
Jean-Michel
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general