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
votes
2
answers
130
views
"No operator '<<' matches these operands" error for JSON::Value, how to write it to cout? [duplicate]
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
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
0
answers
205
views
cannot open source file nlohmann/adl_serializer.h in json.hpp
I am getting error:
cannot open source file nlohmann/adl_serializer.h in json.hpp
I have included json.hpp after correctly installing nlohmann-json via vcpkg but getting above error.
When I am ...
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
166
views
How do I correctly overload methods with two input types `Json::value` and `std:string`?
I have a make() static method in a class Response. It is overloaded to take either std::string or Json::Value from jsoncpp.
I overloaded the method to look like this:
Response::make(Json::Value body)
{...
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
...
2
votes
2
answers
432
views
JsonCpp do not protect from uint64 overflow and have weird behavior
I am playing around with JsonCpp and have noticed weird behavior when getting to the end of uint64 range.
Numbers in range works properly.
Numbers above range but between [2**64,2**64+2**11] return 0.
...
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,...
2
votes
0
answers
155
views
json compatibility issue on aarch64 GNU/Linux
I have been facing issues while reading file on ARM64 based system as file is getting truncated and able to read partially only. I am able to read the file properly on linux x8664 .
#include <...
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 ...
0
votes
1
answer
347
views
Jsoncpp reading some characters as escaped unicode
Problem: I'm trying to extract a line from a json file and put it in a txt file. The issue is that certain characters are represented as escaped unicode instead of the standard unicode representation.
...
-2
votes
2
answers
769
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
2
answers
812
views
How do you use the jsoncpp library with cmake and conan2
Having some trouble right now working with conan2, cmake and the jsoncpp library. I've tried to make the jsoncpp a shared library. I've tried using the jsoncpp/json/json.h path. I don't want to run ...
0
votes
1
answer
495
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
6k
views
How to use jsoncpp with Visual Studio 2022
I need my project to be able to use json format.
I was suggested this github : https://github.com/open-source-parsers/jsoncpp
I have been trying to integrate it to my project for multiple hours and ...
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
1k
views
How to remove or erase a "key":"value" pair in a Json::Value object using "key"?
I am working in C++ language, visual studio 2022, and using jsoncpp library for working with Json.
To Give you an Idea, here is an example of Json data I am working with
[
{
"name&...
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
0
answers
46
views
calculate the euclidean distance in a json file
how to calculate the euclidean distance in a json file?
i have a error: no match for 'operator+'
{
"name" : "att5",
"comment" : "5 capitals of the US (...
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
2
answers
585
views
Compilation error g++ + cmake + Conan + macOS m2 + jsoncpp
I'm trying to compile the following MWE that uses jsoncpp installed from Conan and set up with cmake, using g++-12 (from home-brew) but I'm clashing against all types of linking errors. (adding repo ...
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: &...
0
votes
1
answer
221
views
How to include third lib into vscode on windows in c++ lang?
I have set up my vscode env with mingw64 for c++, and now it can use internal lib and compiled succeed, but when i want to use jsoncpp third lib in my project, i got errors:
fatal error: json/json.h: ...
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
1
answer
210
views
iOS 16, iPhone 11 Pro Max, app with SDK 5.2 beta 82 crashing, Library not loaded: @rpath/libjsoncpp.24.dylib
I compiled latest sdk 5.2 beta 82 and tried it, but app is crashing with following stack trace:
dyld[591]: Library not loaded: @rpath/libjsoncpp.24.dylib
Referenced from: <37C02679-31AD-371A-8BBD-...
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 ...
0
votes
0
answers
65
views
Json cpp erroring when pointed in the right place?
When I run this code, it waits for 30 seconds or so and then the terminal exits with:
[process exited with code 3221226505 (0xc0000409)] which I do not recognise at all. I also had this typo return ...
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 ...
0
votes
1
answer
633
views
CMake cannot link executable -ljsoncpp: no such file using github submodules
I am working in a project which uses jsoncpp for parsing and cmake for compilation. I added the jsoncpp official git repository as a submodule to my project with git submodule add REPO_URL external/...
-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&...
1
vote
0
answers
604
views
Passing Json::Value to a function in C++ dll is throwing read access violation exception
I am using JsonCPP library in my C++ project . I created a C++ dll with a function which will take Json::Value as input parameter . I have created another one exe which calls this function by passing ...
0
votes
1
answer
910
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
1
answer
380
views
Vector only contains one element
I'm making a Text Adventure in C++ as an attempt to learn the language. The player interacts using commands like look or travel north. So far I've got code that converts the text to lowercase and then ...
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
1
answer
2k
views
Universal way to copy json arrays to C++ vector (jsoncpp)
I found this soultion to convert any kind of iteratable (vector of bool's, vector of int's, etc.) to a json array, refering to this Post
template <typename iterable>
Json::Value iterable2json(...
1
vote
2
answers
286
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 ...
2
votes
1
answer
10k
views
c++: undefined reference to `Json::Value::Value(Json::ValueType)'
I installed jsoncpp on ubuntu with 'sudo apt-get install libjsoncpp-dev' and tried to run a minimalistic test program:
#include <iostream>
#include <fstream>
#include <jsoncpp/json/json....
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, ...
0
votes
0
answers
1k
views
On parsing Json object using Json::parseFromStream it gives an ordered Json::value how to get original state?
// Parse JSON and show errors if needed
Json::CharReaderBuilder rbuilder;Json::Reader reader;
Json::Value root;
// Configure the Builder, then ...
std::string errs;
std::istringstream config_doc(...
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 (...
2
votes
0
answers
73
views
std::length_error in corrispondenza della posizione di memoria 0x00AAE668
i made a login that get the response from my server and try to parse with jsoncpp but i get this error: std::length_error in corrispondenza della posizione di memoria 0x00AAE668. at "if (...
0
votes
1
answer
751
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
1
answer
199
views
Tuple of Jsoncpp functions
I am currently working with some config files, and I wanted to map options with configuration functions. So far, I have this working code:
std::unordered_map<std::string, void (Model::*)(int)> ...
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 &...
0
votes
1
answer
1k
views
Jsoncpp - How do I read an array?
I'm stuck at trying to read an array from a Json file.
Here is the People.json file:
{
"ID": [
{
"1": {
"name": "Fred",
"...
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
2k
views
JsonCPP throwing a logic error:requires objectValue or nullValue
void exp::example(std::string &a, std::string &b)
{
if (m_root.isObject() && m_root.isMember(a))
{
if (m_root[a].isMember(b))
{
m_root[a].append(...
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 ...
0
votes
0
answers
476
views
Jsoncpp - access array element inside an object?
Is there a "proper" way to extract an element of array which is a child of an object in JsonCPP?
I'm dealing with JsonRPC objects along the lines of:
{
"jsonrpc": "2.0&...