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

How to fix JsonCPP error from getMemberNames()?

The JSON file looks like this: { "strings": [ { "key_one": "value_one!" }, { "key_two": "value_two!" }, ] } The C++ file looks like this: Json::Value root; Json::Reader reader; bool parsingSuccessful =…
unwise guy
  • 1,048
  • 8
  • 18
  • 27
6
votes
2 answers

More graceful error handling in C++ library - jsoncpp

I'm not sure if this will be a specific thing with jsoncpp or a general paradigm with how to make a C++ library behave better. Basically I'm getting this trace: imagegeneratormanager.tsk: src/lib_json/json_value.cpp:1176: const Json::Value& …
djechlin
  • 59,258
  • 35
  • 162
  • 290
5
votes
1 answer

Jsoncpp stop making it write based on elements alphabetical order

I am using Jsoncpp to write a Json::value to a string using the Json::FastWriter. string s; s.append("me?json="); val["firstname"] = firstname; val["lastname"] = lastname; val["x"] = me->myPos.X; val["y"] = me->myPos.Y; val["z"] =…
KaiserJohaan
  • 9,028
  • 20
  • 112
  • 199
5
votes
3 answers

How to ignore null objects when writing JSON with JsonCpp

According to the Google JSON style guide, it is advisable to remove empty or null values. When using JsonCpp, how can empty or null values be removed, either from the object structure or when writing to a stream? I want the following code: #include…
Kevin
  • 4,070
  • 4
  • 45
  • 67
5
votes
1 answer

How to find the number of objects or array in a JSON data using jsonCpp

My primary need is how to find the number of elements in top level data. Given the json data: { [ {Key11:Value11,Key12:Value12,...Key1N:Value1N}, {Key21:Value21,Key22:Value22,...Key2N:Value2n}, …
user2779124
  • 79
  • 1
  • 7
5
votes
5 answers

Writing in order to jsoncpp (c++)

Consider the following example for which my source is Json::Value root; root["id"]=0; Json::Value text; text["first"]="i"; text["second"]="love"; text["third"]="you"; root["text"]=text; …
user3853197
  • 69
  • 1
  • 3
5
votes
1 answer

Undefined reference in jsoncpp operator=

How do I resolve the following linker error w.r.t jsoncpp operator=. I create a Json::Value object like this Json::Value pt; pt["type"] = 5; pt["uuid"] = "f8c74622-d45e-4cfa-fe00-5e7042431c72"; pt["start frame"] = 10; pt["duration"] =…
satheeshram
  • 161
  • 1
  • 9
5
votes
1 answer

JSONCPP to Visual Studio

I am having some trouble getting the JSONCPP Library into Visual Studio. I have downloaded the library I am just unsure how to import it into my project and use it in my c++ code.
blakepeterman
  • 328
  • 2
  • 4
  • 15
5
votes
2 answers

Using libCurl and JsonCpp to parse from https webserver

So I've been looking around the internet for a basic example of parsing JSON using libcurl and jsoncpp but I've not been able to find one. Could someone please point me in the right direction or specify here, a simple example of using libcurl and…
Ben Crazed Up Euden
  • 353
  • 2
  • 7
  • 18
5
votes
1 answer

Jsoncpp - very simple test crashes when Json::reader goes ot of scope

I have downloaded and installed the jsoncpp library. I then try to use the library in my own application: #include void parseJson() { Json::Reader reader; } int main(int argc, char ** argv) { parseJson(); exit(0); } The…
user422005
  • 1,989
  • 16
  • 34
5
votes
1 answer

How can I get property name and property value from json-cpp parser?

I'm using jsoncpp parser (http://jsoncpp.sourceforge.net) to parse JSON data. So, if we have the following JSON: { "name": "Joseph", "age": 20 } How can I get the property name name and value Joseph, ... after age and 20? OK, we can do universally…
RePRO
  • 217
  • 1
  • 4
  • 11
4
votes
2 answers

How do I make a jsoncpp array?

I'm stuck with jsoncpp. I would like to create an array like this: "Cords": [{"x": 10, "y": 20}, {"x": 70, "y": 40}, {"x": 15, "y": 65}] I managed to do the regular stuff with jsoncpp (see below) but I am stuck in this case of making a JSON…
JJ Jones
  • 101
  • 1
  • 7
4
votes
2 answers

How works deprecated warnings and how to remove them when using JsonCpp?

I compiled with VS 2015 jsoncpp and am able to link with it and everythign works fine. However, I'm getting tones of deprecated warnings. Some classes are marked as depecrated in the code: class JSONCPP_DEPRECATED("Use StreamWriter instead")…
jpo38
  • 20,821
  • 10
  • 70
  • 151
4
votes
1 answer

Using JsonCpp and Qt Together (Problems with Unicode)

I am trying to write a C++ Qt 4.7 app that gets some JSON from a web API. I have done some reading and JsonCpp seems to be the best. So I built it just find and added it to my project just fine. void…
Joel Verhagen
  • 5,110
  • 4
  • 38
  • 47
4
votes
1 answer

jsoncpp find member function

I'm using v1.6.2 of the jsoncpp library on a Win32 platform. All's well, I'm able to parse json and access Json:Values successfully using v.["firstname"] etc. Q: How do I find a Json:Value by name in a json structure? In the documentation I've…
b06.s
  • 41
  • 2
1 2
3
21 22