320 questions
0
votes
1
answer
57
views
JsonCpp problem with sorting output json - case / alphabetical problem
I have an issue with JsonCpp library in C++ and sorting of keys after the json is produced. I found that JsonCpp is ignoring alphabetical order if there is Lowercase and Uppercase difference. It ...
1
vote
1
answer
73
views
jsoncpp no operator matches these operands ">>"
My C++ program below is supposed to read a json file called english.json and display the "title" information.
#include <iostream>
#include <fstream>
#include <json/value.h>
...
1
vote
1
answer
120
views
Why does this call to Json::Value::append with a pointer compile?
Yesterday I came across a function like this in my team's code, using the jsoncpp library:
#include <json/value.h>
Json::Value makeList() {
Json::Value list(Json::arrayValue);
list.append(...
0
votes
1
answer
192
views
How do I Import jsoncpp to my project sub directory
I am working on a project with this directory structure.
WeaselTestApp
--build
...
--weasel
...
--CMakeLists.txt
--main.cpp
--CMakeLists.txt
--conanfile.txt
...
0
votes
1
answer
124
views
Generate a Json fil whith C++
I wrote a code in C++ to generate a .json file using the JsonCpp library. My issue is that I'm struggling to maintain the display order as it appears in the sequence of code within the file. Currently,...
0
votes
1
answer
275
views
jsoncpp, string to json adding additional characters
I want to replace a parameter in my JSON file with a string. My script scrubs a json file for all 'dialogue' strings, exports them to a txt file where they can be edited and than reimports them back ...
-2
votes
2
answers
771
views
Fatal error with jsoncpp while compiling for Darwin
I am facing the exact same error as this but for mac os
Error message looks like this:
myfile.cpp:12:10: fatal error: json/json.h: No such file or directory
initially I was trying to run it like this:...
0
votes
1
answer
498
views
How to reference other values in JSON without copy pasting?
So I was wondering how can I actually use try to minimize me repeating a particular value and I could just refer to a different key present somewhere in the JSON.
For example in data.json
"...
0
votes
1
answer
221
views
Using JsonCPP to parse API requests but the code wont compile [closed]
#include<string>
#include<iostream>
#include<json/json.h>
#include<cpr/cpr.h>
using namespace std;
using namespace cpr;
int main() {
Response r = Get(Url{ "https://...
1
vote
2
answers
2k
views
How to Merge two Json files into one using C++?
I have 2 Json files having 100,000 records and 5 columns each.
My goal is to merge both files to get a single file with 200k records using C++.
My json files look like this:
[
{
"city&...
0
votes
1
answer
228
views
How to Iterate through Collection without knowing the keys? and Later save those keys
My goal is to extract column heads from a Json file converted from a normal table in CSV (Excel sheet) using C++. I am using Visual Studio 2022 IDE.
My Json file looks like this
{
"people" ...
1
vote
0
answers
140
views
C++ Visual studio jsoncpp: How to drill down json paths
Trying to figure out the syntax for using jsonCPP in visual studio to drill down into a json file.
Not sure how to go beyond the first layer. An example can be seen in the picture as a use case with: &...
2
votes
0
answers
230
views
How can I use the PocketSphinx library in my C++ project?
I'm trying to use the PocketSphinx speech to text library in my project as a Git submodule. So, I added the submodule to my dependency folder and I added the following code to my MakeFile:
...
0
votes
0
answers
2k
views
Fatal error: json.h: No such file or directory #include <json.h> and I am using WSL
I am having trouble using the header files from jsoncpp in my program. I am trying to include the library globally through the use of a makefile CFLAGS, but its hard for me to figure out why its not ...
1
vote
0
answers
220
views
How to get the key name from a JSON::Value variable using jsoncpp in c++?
I am loading my program config at the program start from a json file. To make sure, that the file contains every requested key, I am checking every json key and return its existence to a bool variable ...
-1
votes
1
answer
930
views
Iterate an array from json using jsoncpp
I have the following json:
{
"laureates": [{
"id": "1",
"firstname": "Wilhelm Conrad",
"surname": "Röntgen&...
0
votes
1
answer
911
views
Jsoncpp nested arrays of objects
I need to search for an element in a json file using the jsoncpp library.
I can't wrap my head around how to get to the most inner array... Any thoughts?
{
"key": int,
"array1&...
0
votes
0
answers
824
views
How to set the float precision for the Json::FastWriter using C++ and jsoncpp
I am accessing some json objects via a rest interface, by converting the Json::Value to a string and respond this string to the request.
std::string json_to_string(Json::Value& json_object) {
...
1
vote
2
answers
287
views
C++ read or overwrite variable depending on parameter
it was difficult to find a precise title for the question, so if you have a better nameing, please help me out!
I am working on my program configuration with json, where I read hundreds of values from ...
0
votes
0
answers
1k
views
libc++abi: terminating with uncaught exception of type Json::RuntimeError: * Line 1, Column 1 Syntax error: value, object or array expected
I am trying to get data from my json document into my main.cpp using Jsoncpp. I am getting this error message :
libc++abi: terminating with uncaught exception of type Json::RuntimeError: * Line 1, ...
3
votes
1
answer
332
views
GCC infers pass-by-value copy assignment with jsoncpp
const Descriptor* descriptor_ptr = msg.GetDescriptor();
const Reflection* reflection_ptr = msg.GetReflection();
const FieldDescriptor* field_ptr = descriptor_ptr->field(i);
Json::Value value;
if (...
0
votes
1
answer
753
views
JsonCpp: Serializing JSON causes loss of data in byte string
I have a simple use case where I wish to serialize and transmit vectors of integers between 0 and 256. I surmised that the most space-efficient way of doing so would be to serialize the vector as a ...
0
votes
0
answers
119
views
Search Value from JSON in C++
I want to search argv[2] value in JSON but i couldn't do this. I looked the other threads but they couldn't hep either. Because i am a newbie. So ho can I do this?
#include <iostream>
#include &...
1
vote
1
answer
104
views
JSON array does not display all values if they are same value (jsoncpp used)
If I codded as
Json::Value root, arr;
arr.append(0);
arr.append(0);
arr.append(0);
root["array"] = arr;
The output was like as..
{
"array" : [ 0, 0 ]
}
The problem is that only ...
0
votes
1
answer
509
views
Json::Value as private class member
I'm writing a C++ class for Reading/Writing strings from/to a json file using the jsoncpp lib.
My question is if it's possible to create a Json::Value private member for my class and use this every ...