| Home | Libraries | People | FAQ | More

## 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(const std::string & filename, Ptree & pt,
                     const std::locale & loc = std::locale());

## Description

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

Parameters: |
`filename` | Name of file from which to read in the property tree.
`loc` | The locale to use when reading in the file contents.
`pt` | The property tree to populate.
Throws: | json_parser_error
Notes: | Clears existing contents of property tree. In case of error the property tree unmodified. Items of JSON arrays are translated into ptree keys with empty names. Members of objects are translated into named keys. 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.