Created
December 31, 2020 11:06
-
-
Save LouisdeBruijn/e9784e84f9c43276e4b4db96e69585e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| # JSON encoding | |
| string = "I am a data-scientist and love working with Natural Language Processing." | |
| s = json.dumps(string) | |
| with open("data.json", "w") as json_out: | |
| json.dump(string) | |
| # JSON decoding | |
| string = '["list_item", {"personal":["Louis", null, 8.3, 26]}]' | |
| s = json.loads(string) | |
| with open("data.json", "r") as json_in: | |
| string = json.load(json_in) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment