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
10
votes
1 answer

Create JSON array of strings with jsoncpp

I need to update an index (in JSON format) when writing a new file to disk, and since the files are categorized, I'm using an object with this kind of structure: { "type_1" : [ "file_1", "file_2" ], "type_2" : [ "file_3", "file_4" ] } I thought it…
G B
  • 2,951
  • 2
  • 28
  • 50
9
votes
3 answers

C++ JsonCPP - Removing objectValue from an arrayValue

I've only been using the jsonCPP lib for a couple of month now. Im trying to add and remove an object in an array. Ive used a number of different JSON libs on different platforms but I'm finding it very difficult to work with JsonCPP. Here is the…
tommygr
  • 141
  • 1
  • 5
8
votes
2 answers

How to get JsonCPP values as strings?

I am parsing json data using JsonCpp. I don't really need to understand the data, i just need to print out some properties and their values out. It somehow is hard to do. First I need to know what type the value is and then get the value and then…
Lalith
  • 19,396
  • 17
  • 44
  • 54
7
votes
2 answers

jsoncpp. find object in array by matching value

I have this JSON object: {"books":[ { "author" : "Petr", "book_name" : "Test1", "pages" : 200, "year" : 2002 }, { "author" : "Petr", "book_name" : "Test2", "pages" : 0, "year" : 0 }, …
Petr Shypila
  • 1,449
  • 9
  • 27
  • 47
7
votes
2 answers

how to write a cmake Module for jsoncpp?

I want to use jsoncpp for writing a C++ code in order to parse a JSON file. Let me explain what I did. I created a CMakeLists.txt and I made a FindJsoncpp.cmake along with a simple c++ file to test jsoncpp. When I compile the C++ source without…
sajjadG
  • 2,546
  • 2
  • 30
  • 35
6
votes
1 answer

How to use JSON-CPP?

I've strictly followed this documentation to install and use jsoncpp library in my project : jsoncpp README But I still have this problem with my compilation: g++ -W -Wall -Werror -c -o src/ModConnection.o src/ModConnection.cpp …
Nizar B.
  • 3,098
  • 9
  • 38
  • 56
6
votes
2 answers

JSONCPP Amalgamated link errors

I am trying to use the amalgamated version of jsoncpp(the latest version), but it is producing unresolved external symbol link errors. The code I am using is #include int main(){ Json::Value root; return 0; } and it is giving…
user975989
  • 2,578
  • 1
  • 20
  • 38
6
votes
0 answers

Json::Value::resolveReference(key, end): requires objectValue

Using jsoncpp, I am creating a JSON object. Json::Value root; Json::Value zone1; Json::Value coord; Json::Value gridOrigin; JSON_PEOPLE(){ zone1["zoneID"] = "shop1"; zone1["stamp"] = "##########"; …
batuman
  • 7,066
  • 26
  • 107
  • 229
6
votes
2 answers

What is the way to replace jsoncpp FastWriter with Streambuilder?

I have a jsoncpp value that I want to serialize. The most straightforward way is like this: Json::Value val; // population is left as an exercise for the reader std::string str = Json::FastWriter().write(val); The problem is that FastWriter is…
jwm
  • 1,504
  • 1
  • 14
  • 29
6
votes
3 answers

How to link jsoncpp?

How can I link jsoncpp with a C++ program using g++? I tried: g++ -o program program.cpp -L/path/to/library/files -ljsoncpp, -ljson, -llibjsoncpp but g++ keeps saying: /usr/bin/ld: cannot find -lsomething
Donny
  • 63
  • 1
  • 3
6
votes
2 answers

Iterate over an array of JSON objects with jsoncpp

I have an array of JSON objects, jsonArr say, of the following kind: [ { "attr1" : "somevalue", "attr2" : "someothervalue" }, { "attr1" : "yetanothervalue", "attr2" : "andsoon" }, ... ] Using jsoncpp, I'm trying to iterate through…
John S.
  • 501
  • 2
  • 6
  • 17
6
votes
2 answers

Problems with getting a node out of JSON with jsoncpp

Im trying to use jsoncpp to parse a set of json. The json has been generated from a webpage with simplejson from a django object. I get it from a particular URL using libcurl. WHen I use the toStyledString() function on the root I get this printed…
Mark Lakewood
  • 1,980
  • 4
  • 22
  • 44
6
votes
3 answers

JSONCPP Build with Visual Studio 2010

How do I build it? The documentation is really shady about this. It says you need to place scons.py into the directory, but I have no idea where this is. I have tried using the included prebuild, but it did not produce any .lib files.
Yelnats
  • 489
  • 2
  • 6
  • 9
6
votes
2 answers

JsonCpp Writing back to the Json File

I have a Config file with following contents: { "ip": "127.0.0.1", "heartbeat": "1", "ssl": "False", "log_severity": "debug", "port":"9999" } I have used JsonCpp for reading the content of above config file. Reading the…
Mahadeva
  • 1,584
  • 4
  • 23
  • 56
6
votes
1 answer

converting string map to json using jsoncpp

I am using jsoncpp, is there a way to put a map in Json::Value ? I understand I can extract keys one by one and put them in the Json::Value. but is there a more graceful way ? for example in the C# counter part NewtonSoft json api I would do …
Ahmed
  • 14,503
  • 22
  • 92
  • 150
1
2
3
21 22