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 Property Tree fails to retrieve simple JSON in multi-threaded context

I am trying to parse a simple JSON string using Boost.PropertyTree in my C/C++ application. {"header":{"version":42,"source":1,"destination":2},"coffee":"colombian"} Here is how I've set it up in my C/C++ multi-threaded application (manually…
Kevin
  • 16,549
  • 8
  • 60
  • 74
1
vote
1 answer

Iterate through PTree children w/o including tag name

I would like to know if there is a way to get the data in children nodes by iterating through a vector of the parent nodes. I have an XML file that I plan on changing frequently so hardcoding the attribute names is something I would like to avoid.…
Alexia M.
  • 49
  • 4
1
vote
1 answer

Parsing XML's with Boost PTree w/o tags

I would like to know if Boost Ptree allows parsing .xml files without having the attribute tags known. I have an XML file that will regularly be updated with new tags, new data, and even remove certain tags. These regular changes prompted me to look…
1
vote
1 answer

Getting nested JSON arrays and matrices in C++

I have to read some data from a JSON file using C++. After some research I found Boost Property Tree as the most suggested approach and I was able to get it up and running with simple strings. However, when it comes to deep, nested arrays and…
codesieve
  • 13
  • 4
1
vote
1 answer

How can I read an array of object from a JSON file using boost-property-tree in C++

I am using boost-property-tree in a C++ application, where I am trying to read a JSON file users.json and store the data into a vector of object (std::vector users;). The JSON file looks this this: { "OperatingSystem":"Windows 10", …
Origamer7
  • 315
  • 3
  • 17
1
vote
1 answer

How to convert any value to an object and add members with boost::property_tree json

I have a program that modifies a JSON document if necessary. The program has to add a child to another value whether or not it's an already an object. The program should behave like so: If the object with key "x" does not exist, create object with…
Mikey A. Leonetti
  • 2,834
  • 3
  • 22
  • 36
1
vote
1 answer

For a Boost.Propertytree, is there any way to use JSON dot notation to reference an array element?

It would be great to be able to specify a path into a Boost.PropertyTree containing an array. I can construct a Boost.PropertyTree from this JSON: const char* theJSONTestText = R"FooArrayTest({ "FooArray": [ {"BarIntValue": 10,…
SMGreenfield
  • 1,680
  • 19
  • 35
1
vote
0 answers

Is there a maximum limit of open std::ifstream instances? Problem with > 254 instances

I have a C++ Class with an std::ifstream attribute. Every object of this class on creation takes a file path in the constructor, opens the file and using the std::ifstream attribute and keeps it open during the lifetime of the object. Somewhere else…
locke14
  • 1,335
  • 3
  • 15
  • 36
1
vote
0 answers

How to copy primeNG tree ByValue in typescript which have Circular Structure

What is the most efficient way to clone a primeNG tree object which have Circular Structure? I've done things like obj = JSON.parse(JSON.stringify(o)); //but JSON.stringify() not working for Circular Structuure. var newObject =…
1
vote
2 answers

boost property_tree issues getting values

This is my first experience with boost::property_tree and I can't find a way to reproduce the way to get values from a tree following the documentation (How to Access Data in a Property Tree). This is the simple code that I wrote to experiment with…
Angelo
  • 51
  • 1
  • 5
1
vote
2 answers

how to get name of the node in boost::ptree (not the name of child, we know only the filename)

When we parse any xml file, we got a ptree, but how to know name of the root node? Or like when we pass a node as argument in a function, then how we can get the name of node in function.
Ankit
  • 21
  • 1
  • 3
1
vote
1 answer

What is the fastest way to serialize a boost property tree (ptree) to a vector

I have this code: std::vector getWriteBuffer() { boost::property_tree::ptree jsonTree=getJson(); //This function returns a json in a ptree // I have this code, but is there any faster way to do this? std::ostringstream…
mans
  • 17,104
  • 45
  • 172
  • 321
1
vote
1 answer

ptree get_value with name including "."

"A": "1" "A.B": "2" "A.C": "3" How to get the value of A.B if i iterate through the ptree it works. if i try to get value of pt.get_child("A\.B").get_value(). i get the following exception terminate called after throwing an instance…
raghu
  • 95
  • 1
  • 10
1
vote
1 answer

End tag xml validation incorrect in Boost ptree read xml

I am trying to do some simple xml parsing using Boost Ptrees in C++. However it seems like the read_xml function only throws an error if there is no end tag present. The below throws an error. For eg:
Ajay Nair
  • 1,827
  • 3
  • 20
  • 33
1
vote
2 answers

boost ptree access first element with no path name

I am using boost library to manipulate a JSON string and I would like to access to a first element. I was wondering if there where some convenient way to access a first element of ptree with no path name. I do this, but I got no value : namespace…
LeMoussel
  • 5,290
  • 12
  • 69
  • 122