Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to read object of type json_object * in c++ #413

Closed
boddumanohar opened this issue May 13, 2018 · 4 comments
Closed

how to read object of type json_object * in c++ #413

boddumanohar opened this issue May 13, 2018 · 4 comments

Comments

@boddumanohar
Copy link

I am working on an application where two process exchange data through shared memory. So instead of using structs to pack the data, I choose to use JSON so that I won't face any issues due to compilers.

My sender side is written in C and the receiver side is written in C++14 code.

On my sender side, I can just use

json_object * jobj = json_tokener_parse(string);

and copy this jobj into the shared memory region.

On the reciver side, which is C++, how do I read get the json data from the json_object * object?

I really appreciate the help.

@ploxiln
Copy link
Contributor

ploxiln commented May 13, 2018

Looks like #412 again.

@boddumanohar
Copy link
Author

boddumanohar commented May 13, 2018 via email

@ploxiln
Copy link
Contributor

ploxiln commented May 13, 2018

You should be able to #include <json-c/json.h> and call json-c functions the same way in C++ as you do in C.

@boddumanohar
Copy link
Author

Thanks @ploxiln, this solves my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants