Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template read_json

boost::property_tree::json_parser::read_json

Synopsis

// In header: <boost/property_tree/json_parser.hpp>


template<typename Ptree> 
  void read_json(std::basic_istream< typename Ptree::key_type::value_type > & stream, 
                 Ptree & pt);

Description

Read JSON from a the given stream and translate it to a property tree.

[Note] Note

Clears existing contents of property tree. In case of error the property tree unmodified.

[Note] Note

Items of JSON arrays are translated into ptree keys with empty names. Members of objects are translated into named keys.

[Note] Note

JSON data can be a string, a numeric value, or one of literals "null", "true" and "false". During parse, any of the above is copied verbatim into ptree data string.

Parameters:

pt

The property tree to populate.

stream

Stream from which to read in the property tree.

Throws:

json_parser_error In case of error deserializing the property tree.

PrevUpHomeNext