Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Unassigned: How do I access data by name? [339]

$
0
0
How can I access data by name instead of having to do string processing? Attached please find my code to parse the json.

Comments: Hi gillerman, If you know that the JSON value is an object or an array (this can be tested with [json::value::type()](http://microsoft.github.io/cpprestsdk/classweb_1_1json_1_1value.html#a7ca3bf53302417086935ac022711a4ba)) you can use the [json::value::at(...)](http://microsoft.github.io/cpprestsdk/classweb_1_1json_1_1value.html#ac84af0a5556b83710048aef420be2a7c) and [json::value::operator[]](http://microsoft.github.io/cpprestsdk/classweb_1_1json_1_1value.html#a706c50448fc33f1c76f76a86aeec706f). This can be done instead of iterating through and doing string compare like your attached examples. Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>