Skip to content

Instantly share code, notes, and snippets.

@tamalsaha
Created August 21, 2017 12:26
Show Gist options
  • Save tamalsaha/e8b313aec8f8d8191bc01ba504247e30 to your computer and use it in GitHub Desktop.
Save tamalsaha/e8b313aec8f8d8191bc01ba504247e30 to your computer and use it in GitHub Desktop.
JsonPatch of Array
# https://python-json-patch.readthedocs.io/en/latest/tutorial.html#creating-a-patch
import jsonpatch
src = {
"spec": {
"loadBalancerSourceRanges": [
"192.101.0.0/16",
"192.0.0.0/24"
]
}
}
dst = {
"spec": {
"loadBalancerSourceRanges": [
"192.101.0.0/24"
]
}
}
patch = jsonpatch.JsonPatch.from_diff(src, dst)
print patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment