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

bug: jsonpatch does not play nice with "/" in dict keys #94

Open
johnarnold opened this issue Mar 21, 2019 · 1 comment
Open

bug: jsonpatch does not play nice with "/" in dict keys #94

johnarnold opened this issue Mar 21, 2019 · 1 comment

Comments

@johnarnold
Copy link

Version: 1.23
Issue: Jsonpatch doesn't handle "/" characters correctly. E.g. when trying to create a patch/diff from an existing dictionary, if there is "/" in a key, it adds/substitutes "~1"

Minimum repro:

import jsonpatch
test_dict = {'/fields/test': '123456'}
patch = jsonpatch.make_patch({}, test_dict)
patch.patch

Expected:

[{'op': 'add', 'path': '/fields/test', 'value': '123456'}]

Actual:

[{'op': 'add', 'path': '/~1fields~1test', 'value': '123456'}]
@johnarnold
Copy link
Author

Actually, is this expected behavior? (reading the RFC...)

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

1 participant