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

Difference between merge_patch and update #1183

Closed
jdumas opened this issue Aug 2, 2018 · 3 comments
Closed

Difference between merge_patch and update #1183

jdumas opened this issue Aug 2, 2018 · 3 comments
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@jdumas
Copy link

jdumas commented Aug 2, 2018

Hi,

I was wondering what is the difference between j1.merge_patch(j2) and j1.update(j2)? The two methods seem to have a similar behavior, but I am not sure exactly how they differ (they appear to have different purposes). I was using merge_patch() for a while because I was not aware of the update() method, so maybe it would also make sense to update the doc so they can point at each other (even if it's a warning to say they should not be confused).

@nlohmann
Copy link
Owner

nlohmann commented Aug 2, 2018

@nlohmann nlohmann added kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation labels Aug 2, 2018
@jdumas
Copy link
Author

jdumas commented Aug 2, 2018

Thanks for the clarification!

@jdumas jdumas closed this as completed Aug 2, 2018
@jdumas
Copy link
Author

jdumas commented Aug 6, 2018

Ok looks like one other important difference that should be pointed out is that update() is not recursive, and will not update/merge nested json dictionaries, whereas merge_patch() will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants