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

duplicate an json_object #290

Closed
wants to merge 1 commit into from
Closed

duplicate an json_object #290

wants to merge 1 commit into from

Conversation

chennqqi
Copy link

@chennqqi chennqqi commented Dec 2, 2016

I add an function json_object_duplicate to duplicate an json_object. Do you accept this PR?

@hawicz
Copy link
Member

hawicz commented Dec 5, 2016

First of all, this doesn't compile due to the mismatched function prototype, but even if you fix that the approach of serializing the object tree into a string and then parsing it back out, while obviously convenient, is not one that I will accept into the library.
Instead, the code should walk the tree and copy each object directly. The recently added json_c_visit() function may be a useful way to do this.

@hawicz hawicz closed this Feb 25, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants