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 an old version of boost. Click here for the latest version's documentation home page.
PrevUpHomeNext

Function template write_json

boost::property_tree::json_parser::write_json

Synopsis

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


template<typename Ptree> 
  void write_json(std::basic_ostream< typename Ptree::key_type::value_type > & stream, 
                  const Ptree & pt);

Description

Translates the property tree to JSON and writes it the given output stream.

Parameters:

pt

The property tree to tranlsate to JSON and output.

stream

The stream to which to write the JSON representation of the property tree.

Requires:

pt cannot contain keys that have both subkeys and non-empty data.

Throws:

json_parser_error

Notes:

Any property tree key containing only unnamed subkeys will be rendered as JSON arrays.


PrevUpHomeNext