Questions tagged [jsoncpp]

jsoncpp is an open source JSON reader and writer for C++

jsoncpp is an implementation of a JSON reader and writer in C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

318 questions
0
votes
1 answer

nlohmann parsing a json file without knowing keys

I'm using nlohmann/json library to use json in cpp. I have a Json::Value object and I would like to go through my json data by exploring the keys without knowing them. I came across the documentation but only found the object["mySuperKey"] method to…
pipou
  • 270
  • 3
  • 15
0
votes
0 answers

How to link external C++ library to my project on Mac OSX

I'm running on Mac OSX, and have a very simple C++ project where I want to use the library jsoncpp. Stripped back, this is what I have: main.py #include ... CMakeLists.txt cmake_minimum_required(VERSION…
numberjak
  • 1,065
  • 4
  • 13
  • 28
0
votes
1 answer

How to specify install directory for shared libraries for jsoncpp 0.10.7 with cmake?

I'm building https://github.com/open-source-parsers/jsoncpp/tree/0.10.7 for an embedded system because that's the recommended version if c++03 support is still needed. My target is based on Ubuntu 12.04. CMakeLists.txt has include(GNUInstallDirs) so…
Simon Elliott
  • 2,087
  • 4
  • 30
  • 39
0
votes
1 answer

Differentiate between int and uint type in jsoncpp

I'd like to parse some json data after reading it with jsoncpp which differentiates between int and uint data type. The meaning of these types is clear to me, but when I read data like value: 7, jsoncpp recognizes this as int. Of course, value may…
lukasl1991
  • 241
  • 3
  • 11
0
votes
1 answer

Write to existing json file

I am using this code to add to my existing JSON file. However It completely overrides my JSON file and just puts one JSON object in it when I would just like to add another item to the list of items in my JSON file. How would I fix this? Json::Value…
shane
  • 342
  • 1
  • 5
  • 28
0
votes
2 answers

Standard way of Serializing utf-8 characters in a JSON String

What's the standard way of serializing a utf-8 string in JSON? Should it be with u escaped sequence or should it be the hex code. I want to serialize some sensor readings with units in a JSON Format. For example I have temperature readings with…
0
votes
1 answer

C++ JSON parse error... in Json::Value::getMemberNames(), value must be objectValue error

I am trying to parse a json file below: [ { "date": "Mon 24 Dec 7:47:37 2018", "toRecipient": "Vinny", "subject": "Hi Vinny", "body": "This is Tony", "fromRecipient": "Tony" }, …
Tony
  • 77
  • 3
  • 12
0
votes
1 answer

JSONCPP append to file

I'm using JSONCPP to log messages I get on my server, but instead of appending a message, it replaces last message. This is the code I have: the ofstream and event are private members. //std::ofstream myfile; m_file.open ("messageLogs.json"); …
Dries Jans
  • 107
  • 1
  • 11
0
votes
1 answer

Parse json file from AWS S3 with C++ and Jsoncpp

I have this C++ function that downloads S3 files as istreams using the AWS SDK C++: std::istream& s3read(std::string bucket, std::string key) { Aws::Client::ClientConfiguration aws_conf; aws_conf.region =…
Medical physicist
  • 2,510
  • 4
  • 34
  • 51
0
votes
0 answers

Appending child's Json::Value after appending parent's Json::Value does not change parent data, any suggestion?

I am constructing json from tree data, but when i add node_level_3 from node_level_2 after adding node_level_2 from node_level_1, node_level_2 does not has information abour node_level_3. Here is my code. node_level_1 = new…
Knowledge Drilling
  • 986
  • 1
  • 8
  • 22
0
votes
0 answers

LNK2019 unresolved external sumbol (cURL & Jsoncpp)

I have been searching the internet for quite some time to find a solution to my problem and not a single one has worked. So if you can help I will be very thankful! I have compiled the jsoncpp.lib and libcurl.lib and including them in my C++ project…
0
votes
1 answer

Getting an unresolved external symbol when using jsoncpp NuGet package

I have this simple piece of code where I am using the jsoncpp version 0.6.0.1 NuGet package to read from a json file in VS2013. #include #include #include "json\json.h" using namespace std; Json::Value readJson(){ …
shreeya
  • 145
  • 1
  • 14
0
votes
1 answer

How can I ask jsoncpp to encode unicode strings?

I'm using the following code to test jsoncpp #include #include using namespace std; int main(int argc, char ** argv) { Json::Value root; root["test"] = "中文测试123"; Json::StyledWriter styledWriter; cout <<…
daisy
  • 22,498
  • 29
  • 129
  • 265
0
votes
2 answers

jsoncpp error: ‘PrecisionType’ is not a class or namespace

I download jsoncpp on Github. And built and installed it with meson and ninja. But when I include in my program, I got the error: ‘PrecisionType’ is not a class or namespace. Is there anything wrong in "json/writer.h" ? Error:
Zeno
  • 1
  • 2
0
votes
1 answer

C++ JsonCpp: Loop through objects and get value

I got a little problem. My json looks like this: { "data" : { "Money" : { "testUser3" : "500", "testUser2" : "23", "testUser1" : "2435", "testUser" : "60" } }} And I am trying to get the value + names…
lolpop16
  • 57
  • 1
  • 5