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.
351
questions
0
votes
0
answers
27
views
How to extract complete string from JSON using ptree.get_child in cpp?
Json File
{
"a" : "Hello",
"b" : {
"c" : "World",
"d" : ["Hello","World"]
}
}
This is the following code I've ...
2
votes
1
answer
128
views
Need to draw vertical lines in expand/collapse in p-tree
I am using p-tree from prime-ng, and need to draw the vertical lines(Highlighted with red pen) via css like this:
I have done the rest part and working fine, only vertical lines need to draw. My ...
0
votes
1
answer
34
views
Xml without indent char but with new line
Is there a way to write xml using boost::property_tree, without indent characters but with new line?
Consider this code
using namespace boost::property_tree;
int main() {
ptree tree;
ptree* ...
1
vote
1
answer
101
views
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 ...
0
votes
0
answers
29
views
Boost's read_ini throws exception "'=' character not found in line" but file structure is correct
I have the following throwing an exception that is logged as:
Failed to read in "Configuration File.ini". Exception: Configuration
File.ini(1): '=' character not found in line
However, the ...
1
vote
1
answer
158
views
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<boost::property_tree::...
1
vote
2
answers
136
views
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<boost::...
1
vote
0
answers
124
views
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 ...
1
vote
1
answer
316
views
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 ...
0
votes
1
answer
40
views
boost::property_tree C++ JSON Writer, unwanted number formating
i am writing JSON files using boost::property_tree, my JSON contains large numbers, numbers are comma separated with EN_US.UTF-8 locale or separated by space with fr_FR.UTF-8 locale, i cannot get rid ...
0
votes
0
answers
60
views
<p-tree> :Converting circular structure to JSON
I want to retain the selected tree node hence I wanted to save the selected treenode in localstorage but I see this following error:
If anyone knows the solution for this?
code:
component.ts file
...
1
vote
1
answer
330
views
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) ...
-1
votes
1
answer
402
views
How to disable NodeTree (parents and children) in primeng?
This is my HTML code:
<p-tree id="tree" *ngIf="node" [value]="node" selectionMode="null" [(selection)]="selectedFile" (onNodeSelect)="...
0
votes
1
answer
232
views
How to add a key with a dot in the name to a json file [duplicate]
I am reading some information and I want to write it in json, but the names of some keys contain dots in the name. I want to get something like this:
{
"programs":
{
"tmp.exe&...
0
votes
0
answers
95
views
BOOST_OVERRIDE error when I try to make examples of property_tree of boost library
I am trying to compile boost's property_tree's examples.
cmake executes successfully: but I get the following error messages when I run the command make:
here are the commands I execute:
$> cd ./...
1
vote
1
answer
316
views
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
...
1
vote
1
answer
226
views
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 ...
2
votes
0
answers
161
views
Convert JSON model to primeNg p-tree nodes Angular
I'm trying to use the tree component of PrimeNG https://www.primefaces.org/primeng/#/tree
I'm trying to convert an array of objects into an array of TreeNode, in order to be displayed like a tree.
My ...
0
votes
1
answer
198
views
boost property tree adds empty line with write_xml()
I am using boost (version 1.70.0) property tree. If I have this XML (no empty lines):
<Root>
<SomeOtherElement>..</SomeOtherElement>
<Collection>
<Item Attr1="....
2
votes
1
answer
128
views
Converting Boost ptree node to XML string
I am using boost (version 1.70.0) property tree. Is there a way to convert a node to XML string including the node itself, not just node's children?
If I have this XML:
<Root>
<...
0
votes
1
answer
90
views
why boost property tree xml serializer cannot preserve multi-line values?
I am working with boost property tree (v.1.72.5) to read and write xml files. I know that according to the documentation:
The XML storage encoding does not round-trip perfectly. A read-write
cycle ...
1
vote
1
answer
174
views
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 comments.
https://www.boost.org/doc/libs/1_76_0/doc/...
0
votes
0
answers
44
views
How to read specific value from the xml file using boost xml in C++?
Using below xml message format, I am trying to read value of the key "zip code". i.e, "90952"
<list>
<address>
<key>Name</key>
<string>Alice ...
1
vote
1
answer
201
views
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 <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/...
2
votes
1
answer
180
views
How to remove the special character that write_json is adding to the string in boost C++
write_json is converting the string "test/123" as "test\/123". How to remove the special character (\) that write_json is adding to the string in boost C++
Thanks,
1
vote
1
answer
122
views
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 = boost::...
2
votes
1
answer
151
views
boost property tree json
i have a JSON file:
{
"level_1" :
{
"level_1_1" : [[1, "text", 0, 1, 2],
[2, "text", 1, 3, 4],
[3, "...
0
votes
0
answers
18
views
Fail of auto with boost::property_tree? [duplicate]
While using boost::property_tree to parse json, I ran into an error and found a fix, but I do not understand why this fix works, or what the error was in the first place. It looks like auto fails here ...
1
vote
1
answer
78
views
Storing a nested XML structure in form of BGL graph using BOOST library
I'm trying to store the nested XML file:
<?xml version="1.0" encoding="utf-8"?>
<root>
<type>
<cars>
<car name="Garfield" weight="4Kg"...
0
votes
1
answer
229
views
Parsing a nested XML file for its attributes using BOOST library in c++
My XML file is nested as follow:
<?xml version="1.0" encoding="utf-8"?>
<root>
<type>
<cars>
<car name="Garfield" weight="4Kg">
&...
1
vote
1
answer
267
views
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 ...
0
votes
1
answer
212
views
recursively get complete key path to all values in a boost property tree
I'm reading an XML file into a boost::property_tree and trying to get the complete key path for every value.
Does boost have a built in way to do this
Were is the error in my recursion?
example ...
1
vote
2
answers
42
views
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 ...
1
vote
1
answer
1k
views
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&...
0
votes
1
answer
331
views
Angular PrimeNG pTree TreeNode
How to get the positions of nodes of TreeNode of pTree in Angular as per the hierarchial order in which they are displayed?
I am having data of type TreeNode and in the data I am also having children, ...
2
votes
1
answer
202
views
what(): No such node json boost
I am trying to parse below JSON file using boost::property_tree.
{
"pi": 3.141,
"temp": 3.141,
"happy": true,
"name": "Niels",
&...
0
votes
1
answer
107
views
Is there a way to save raw binary data from a registry call to a string without casting it as a string?
I'm working on an utility to hook various bits of the Windows API used by different applications. The aim of the project is, at the moment to make any application portable by redirecting filesystem ...
2
votes
2
answers
467
views
How can i decide the datatype Boost Property Tree uses?
I am using the Boost Property Tree for a Project and came across a problem. I'm using it like this:
using Namespace boost::property_tree;
ptree proot;
int myInt = 5;
proot.put("Number", ...
0
votes
0
answers
35
views
I have a Huge XML File of which I want to read its childtrees into the C++ boost::property_tree::pTree type
The normal way of doing it is using
boost::property_tree::ptree pt1;
boost::property_tree::read_xml( XML_FILE_PATH, pt1 );
But what this does is that it reads the entire XML File, which is really ...
2
votes
0
answers
30
views
C++ / Boost:: Propery_Tree - Is it possible to take ini config value with dot in name [duplicate]
Here is my code:
My Config.h:
#include <string>
#include <boost/property_tree/ini_parser.hpp>
namespace pt = boost::property_tree;
class Config {
public:
Config(std::string conf);
...
1
vote
1
answer
56
views
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 ...
1
vote
1
answer
127
views
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 ...
4
votes
2
answers
1k
views
Boost property_tree error: conversion of data to type "j" failed when getting an element in a .ini file
I have a .ini file contains below data
[SYSTEM]
num_of_vps = 1
And I have this code to read an element in .ini file. (uint defined as typedef unsigned int uint)
boost::property_tree::ptree pt;
boost:...
0
votes
2
answers
417
views
Boost.PropertyTree doesn't release memory in destructor
I test the following code
#include <boost/property_tree/xml_parser.hpp>
namespace pt = boost::property_tree;
int main()
{
{ //1
pt::ptree xml;
pt::read_xml("very_big_xml.xml", xml);
...
1
vote
1
answer
797
views
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,...
0
votes
0
answers
26
views
Faulty JSON is getting generated using boost::property_tree::ptree
I am using boost::property_tree::ptree to add data and create JSON file. The following is the recursive code that I have written -
using Strings = vector<string>;
Strings _headers;
map<...
0
votes
1
answer
55
views
Does boost::property_tree::xml_parser::read_xml preserve the order?
Considering the following xml element:
<elem>
<sub_elem name="first">
<sub_elem name="second">
</elem>
Concerning the property tree populated by boost::property_tree::...
0
votes
2
answers
2k
views
PrimeNG p-tree: How to hide certain node from ptree on basis of a boolean value coming from json file?
I am using primeng tree to display json data like this:
<p-tree [value]='dataToDisplayFromConfig' selectionMode='checkbox' [(selection)]='selectedData'>
The JSON data is being read into ...
6
votes
1
answer
1k
views
Any standard library implementation for boost::property tree
Is there an alternative to to "boost/property_tree" ?
Actually I'm trying to remove all boost implementations of C++ and use standard library functions.
I've been able to find alternatives to some ...
2
votes
1
answer
658
views
Using boost::property_tree::ptree how to get the value of a specific key
How do I parse all the sections that are present in the file and get the value for each key.
That is, I have to parse section1, get the value for key1, key2, key3 . Proceed to section2 get the value ...