Skip to content

Instantly share code, notes, and snippets.

@antonalekseev
Created January 9, 2019 17:17
Show Gist options
  • Select an option

  • Save antonalekseev/956f207eb05d6fa6d38157f5bde07a32 to your computer and use it in GitHub Desktop.

Select an option

Save antonalekseev/956f207eb05d6fa6d38157f5bde07a32 to your computer and use it in GitHub Desktop.
python-json-format created by antonalekseev - https://repl.it/@antonalekseev/python-json-format
{ "value": [1, 2, 3, 4, 5] }
{
"value": [
2,
3,
4,
5,
6
]
}
import json
with open("file.json", "r", encoding="utf-8") as fd:
content = json.load(fd)
content["value"] = [int(x) + 1 for x in content["value"]]
with open("file1.json", "w", encoding="utf-8") as fd:
json.dump(content, fd, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment