On 12/04/2011 12:38 AM, Leandro Santiago wrote:
One sugestion: What if inform, in the deserialize() call the name of
the root node in the json tree, as it's done in serialize()? Or make
the deserialize "discover" the name of the root node?
In the example, deserialize(ms,"ms")
2011/12/3 Tommi Mäkitalo<[email protected]>:
I already answered the mail, but just to Leandro. Sorry. But anyhow I
can add something. I told Leandro, that I implemented the suggested
feature. And now the other way around is also possible.
I improved the json serializer a little, so that it does not wrap
everything to a json object. You can just call the new serialize method
without a name and you get just the json representation of that value. E.g.:
std::vector<int> data;
data.push_back(7);
data.push_back(18);
cxxtools::JsonSerializer s(std::cout);
s.serialize(data);
prints:
[7,18]
When using the Json Deserializer, you can just read the value back to a
vector:
std::istringstream data("[7,18]");
cxxtools::JsonDeserializer d(data);
std::vector<int> data;
d.deserialize(data);
fills just the vector.
There are unit tests for json serializer and deserializers also.
Tommi
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general