Questions tagged [boost-propertytree]

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

Note: Boost.PropertyTree is not a generic XML parser. It is not intended to be used as a fast-and-dirty way to load arbitrary XML files into memory. It's XML serialization capabilities are for serialization. It is intended to read the XML that it has written.

Please stop using Boost.PropertyTree as a generic XML parser.

354 questions
1
vote
1 answer

Boost read_json is not working with wptree from std::wstring

I have a simple code which is not working and I don't really know why... here it's: std::wstring CDbFilterSerializer::DeserializeFromString(const std::wstring& jsonStr) { std::wistringstream ss{ jsonStr }; boost::property_tree::read_json(ss,…
1
vote
1 answer

Getting an exception when reading values using BOOST_FOREACH from the JSON array in C++

I am getting the below error when reading the values using BOOST_FOREACH: Unhandled exception at 0x76FCB502 in JSONSampleApp.exe: Microsoft C++ exception: boost::wrapexcept at memory location 0x00CFEB18. Could…
sas
  • 89
  • 8
1
vote
2 answers

Unhandled exception when trying to retrieve the value from the JSON ptree using Boost C++

I am getting the below error when reading the value from the JSON ptree using Boost C++ Unhandled exception at 0x7682B502 in JSONSampleApp.exe: Microsoft C++ exception : boost::wrapexcept at memory location…
sas
  • 89
  • 8
1
vote
1 answer

TreeNode - PrimeNG: How to Remove a node from tree?

I have a tree and if I select two nodes they are saved correctly, but if I later decide to delete only one node of the two previously selected, both are deleted. How can I delete only one? this is the part of the code where I check for unselected…
Sophia
  • 11
  • 3
1
vote
1 answer

Writing and Reading boost Property Tree From/To File?

I want to write a boost::property_tree::ptree binary to a file, and read it out again into a ptree. Since i´m not very comfort with the ptree and binary writing/reading them.. I thought you guys can lead me into the right direction. Writing strings,…
1
vote
1 answer

C++ and boost 1.71 - error: reference to ‘_1’ is ambiguous

I am using the libraries websocketcpp and boost 1.71. The code used to work with boost 1.58 but after upgrading both libraries, it won't compile. The C++ compiler is g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 and the code is the following: using…
grouser
  • 618
  • 8
  • 23
1
vote
1 answer

Read a sub json using boost property tree

I need to read a field in a JSON file which itself is a JSON. I need to read the JSON field in one go. Is there any way available? Sample JSON I am trying to read is provided below. enter code here { "responses": [ { "id":…
user13260866
  • 131
  • 1
  • 2
  • 9
1
vote
1 answer

How to modify node element with boost::property_tree and put_value(const Type &value)

I am fairly new to boost::property_tree and I am having a little trouble with what should be a simple task. I have a default xml file of which is to be copied and made unique with parameters passed into via the ptree & modelModifier(...) function…
jabroni
  • 167
  • 16
1
vote
1 answer

Boost property tree to parse custom configuration format

Following this link provided by @sehe in this post Boost_option to parse a configuration file, I need to parse configuration files that may have…
visitor99999
  • 163
  • 1
  • 10
1
vote
1 answer

How to set target XML doctype using boost::property_tree::write_xml?

I would like to set the DOCTYPE of the generated XML document by boost::property_tree::write_xml: #include #include #include int main() { using ptree =…
Adrian Maire
  • 14,354
  • 9
  • 45
  • 85
1
vote
1 answer

Encoding does not switch when trying to read json file

I have a json file file.json encoded KOI8-R. Boost Json only works in UTF-8 encoding, so I'm converting the file from KOI8-R to UTF-8: boost::property_tree::ptree tree; std::locale loc =…
1
vote
1 answer
1
vote
1 answer
1
vote
1 answer

Custom get method in c++ boost json ptree

I'm trying to access missing values in boost json ptree. When the key was not matched, a method should be called, in which I can define the returned value. For calculation of returned value I need to access the ptree. Example: the ptree is: { "1":…
olexij
  • 11
  • 1
1
vote
2 answers

Can this boost ptree block be shorter (and smarter)?

I'm creating a JSON string exploiting boost ptree library but I'm finding it tedious just by doing the following. I need to add a simple array like "metric.name" : [A, B] to the metrics ptree. Can I do better than this? Or at least write this in a…
Barnercart
  • 1,523
  • 1
  • 11
  • 23