-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 deep copy json_object in C++ ? #301
Comments
There is currently no copy function available, but it could be implemented with json_c_visit. A pull request to add this would be welcome. As a quick, though rather inefficient, hack people have converted their object to a string then re-parsed it to get an independent object. |
Thanks to hawicz's detailed answer! And i will implement the Copy Function with your advice and blog. In addition, let me know another web site about ‘json-c’ |
hi, I use 'json-c' in C++ and define
json_object* mJson
as a member variable ofclass Response
. (Defined the code below)In member function
bool Response::GetJson(json_object **result)
, I getjson_object *
pointer with passing paramjson_object **result
, and then operatejson_object *
.But I want to deep copy of
json_object *
in member functinbool Response::GetJson(json_object *result)
. I did not found 'releated copy funcion' in json-c api.How can i do it? Or Is it necessary to deep copy of
json_object *
? Thank you!Here is my code:
The text was updated successfully, but these errors were encountered: