Skip to content

Instantly share code, notes, and snippets.

@iloveicedgreentea
Created June 14, 2021 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iloveicedgreentea/62ceb47b6796b0b7742f8b9b96776fd1 to your computer and use it in GitHub Desktop.
Save iloveicedgreentea/62ceb47b6796b0b7742f8b9b96776fd1 to your computer and use it in GitHub Desktop.
Read json data - python
import json
# Read a file and get some value if it is false
with open("test.json", 'r') as file:
json_input = json.loads(file.read())
for i, val in enumerate(json_input["somelist"]):
if val is False:
print(f"{i}: False")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment