Questions tagged [json-spirit]

JSON Spirit is a JSON parser implementation written on C++ and based on boost::spirit

The parser is open source, it can be downloaded from CodeProject.

20 questions
5
votes
0 answers

JSON_Spirit: good examples of unpacking a JSON string?

Any good examples/tutorials of unpacking JSON strings with the C++ JSON_Spirit library? Something that can traverse a json_spirit::Value object and pretty-print it would be ideal.
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
4
votes
2 answers

Getting value from json-spirit

I'm using the Json-Spirit library, however i'm unsure how to read value from an object, without iterating over each of the name-value pairs. If i have an object such that: { "boids": { "width": 10, "count": 5, …
Onedayitwillmake
  • 711
  • 1
  • 10
  • 19
3
votes
1 answer

Using json-spirit to read json string in C++

How to use json-spirit to read json string in C++? I read the demo code. I find that: const Address addrs[5] = { { 42, "East Street", "Newtown", "Essex", "England" }, { 1, "West Street", "Hull", …
Jeff Lee
  • 783
  • 9
  • 17
2
votes
0 answers

How should I encode stuff?

I'm generating code to encode various C++ structs in JSON using JSON spirit. The generated code currently looks something like this: Value _encode(df::tile_page rval){ Object val; val.push_back(Pair("token", encode(rval.token))); …
AnnanFay
  • 9,573
  • 15
  • 63
  • 86
2
votes
1 answer

.Net's Json Date & C++ Client

I have an MVC project that provides (GET) & consumes (PUT) a Json object. The JsonValueProviderFactory automatically binds the Json object to the model object. One of the property in the object is DateOfBirth of type DateTime. When I do a GET, the…
Gautam Jain
  • 6,789
  • 10
  • 48
  • 67
2
votes
0 answers

JSON SPIRIT: C++ JSON Parser/Generator bug on heavy load

I ' m developing an c++ application to handle transactions,I'm using JSON SPirit to parse/ generate JSOn's. It works perfectly fine until we try a heavy load of transactions . At that time(more than 30 transactions) it crashes.When I look in to the…
2
votes
1 answer

what is the json-spirit linker flag for g++?

I can't find this anywhere. I've installed json-spirit on my ubuntu server with apt-get install json-spirit-dev. What linker flag has to be used with g++ to use json-spirit?
user1382306
1
vote
1 answer

Pretty-printing with JSON Spirit

My C++ program receives a long (thousands of symbols) JSON string, which I'd like to print using JSON Spirit (for debugging) with multiple lines, right indentation etc. For example: { "abc": "def", "xyz": [ "pqr": "ijk" ] } and so on. I…
HEKTO
  • 3,876
  • 2
  • 24
  • 45
1
vote
0 answers

using json spirit to read the name and value of Value objects in C++

I have a text file that's got data written in JSON format. The data looks something like this -- [ ... { "volume": 93, "id": "part-30", "value": 19 }, { "volume": 83, "id": "part-31", "value": 19 } …
Raaj
  • 1,180
  • 4
  • 18
  • 36
1
vote
1 answer

JSON_Spirit: how to get value

I am working with cpp to build a project. My project needs a file to do some configuration and I decided to use a file with JSON format. Here is an example: { "agentname":"agent1", "server":[ {"ip":"192.168.0.1"}, …
Yves
  • 11,597
  • 17
  • 83
  • 180
1
vote
1 answer

How to read recursive json data with json spirit

I have a recursive Json file the format is below; I have two parts condition and action. In condition part there can be n-root and leaves pairs, and inside leaves part there can be additional values. I have problems about handling this data…
Oguz Ozcan
  • 1,497
  • 13
  • 21
1
vote
1 answer

‘obj_type’ was not declared in this scope, note: suggested alternative: enum Value_type

I'm using JSON Spirit to parse and generate json. I cannot use using namespace json_spirit because another library uses conflicting names. I'm trying to detect the type as specified here of a read message with if(message.type() == obj_type) but the…
user1382306
1
vote
1 answer

Undefined symbols with json spirit and Os X Mavericks

Since the recent update Mavericks, I have a problem linking with the library json_spirit. I installed the new Command Line Tools, but I'm using gcc47 installed via macports. Json spirit (v4.06) has been compiled with the same gcc (after the…
Michaël
  • 63
  • 1
  • 4
0
votes
1 answer

Trying to write a JSON to a file using JSON Spirit in C++

I am trying to write to a JSON to a file using JSON Spirit. I am using the code similar to the examples given on the website to do this as follows: json_spirit::Object emotion_json; emotion_obj.push_back(json_spirit::Pair("Dominant emotion",…
peachykeen
  • 4,143
  • 4
  • 30
  • 49
0
votes
2 answers

JSON_Spirit: mapping value.type() back to the type?

You can display a Value's type like this: cout << val.type() << end; and it print a number. How can I map this number back to the actual type? besides peeking in the header file, of course, which reveals all... enum Value_type { …
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
1
2