
Json with Python
Presentation
•
Computers
•
Professional Development
•
Hard
Jeff Thuong
Used 4+ times
FREE Resource
9 Slides • 6 Questions
1
Manipulation of JSON with Python
Some text here about the topic of discussion
2
Remember what is JSON?
No problem, here is what you need to know
Reminder about JSON
JSON x Python
3
In JSON, values must be:
a string
a number
an object (JSON object)
an array
a boolean
null
JSON values cannot be one of the following data types:
a function
a date
undefined
JSON x Python
Data is stored as dictionary with the key being a string
{
"a string": "This is a string",
"a number": 1,
"a_boolean": true,
"another_boolean": false,
"nothing": null,
"an array": [1, 2, 3],
"an object": {
"name": "Jeff",
"age": 99
}
}
4
import json
JSON in Python Standard Library🎉
You can write (dump / dumps)
and read (load / loads)
JSON x Python
JSON x Python
5
dumps (... with a -s)
json.dump(obj, fp, *, skipkeys=False, ...)
Dump a JSON string of an object to an open file
with open("data.json", "w") as f:
json.dump(my_data, f)
dump
Writing
JSON x Python
json.dumps(obj, *, skipkeys=False, ...)
Dump a JSON string of an object to a string
json_repr = json.dumps(my_data)
6
loads (... with a -s)
json.load(fp, *, ...)
Load JSON data from open file
with open("data.json") as f:
data = json.load(f)
load
Reading
JSON x Python
7
Multiple Choice
Which function can READ data from
a json file opened ("with open(...) as f: ...")
json.read
json.load
json.dumps
json.loads
8
Multiple Choice
Which function can READ data from
a json stored in a string (json_string = '{"name": "jeff"}')
json.read
json.load
json.dumps
json.loads
9
Multiple Choice
Which code DOES NOT write JSON
representation of a data (e.g. a dictionary)
with open("data.json") as f:
json.dump(data, f)
with open("data.json", "w") as f: f.write(json.dumps(data))
f = open("data.json", "w")
json.dump(data, f)
10
Open VS Code, create a Jupyter Notebook and start dumping / loading JSON data
Now your turn!
11
Multiple Choice
Which data CANNOT BE dumped to JSON?
None
List
Dictionary
Tuple, like: (1, 2, 3)
Dates (datetime.datetime object)
12
Multiple Select
Which data would be different after being dumped to JSON and loaded
(SEVERAL ANSWERS POSSIBLE)?
None
Dictionary with keys different from strings
Lists with a mix of integers and strings
Tuple, like: (1, 2, 3)
13
We cannot dump this type of data in JSON
Date and Path => Error
JSON x Python
14
We can use a serializer and pass it as "default" argument.
... but data will still be a string after loading
BONUS: dumping dates
JSON x Python
15
Poll
How much do you understand handling of JSON with Python now?
Very Good
Good
So-so
Still confused
Manipulation of JSON with Python
Some text here about the topic of discussion
Show answer
Auto Play
Slide 1 / 15
SLIDE
Similar Resources on Wayground
10 questions
Python _ review
Presentation
•
9th - 10th Grade
11 questions
ÔN TẬP
Presentation
•
Professional Development
12 questions
virtualization and cloud computing-Part 1
Presentation
•
Professional Development
13 questions
informatica_basica_04/03/2024
Presentation
•
Professional Development
13 questions
Unidad 2
Presentation
•
University
10 questions
Алфавит Python - 6 класс
Presentation
•
KG
11 questions
Atividade Desafio Paraná
Presentation
•
Professional Development
10 questions
IPC Lesson
Presentation
•
Professional Development
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
Afterschool Activities & Sports
Quiz
•
6th - 8th Grade
19 questions
ROAR Week 2026
Quiz
•
9th - 12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
15 questions
Cool Tool:Chromebook
Quiz
•
6th - 8th Grade
22 questions
would you rather
Quiz
•
3rd - 11th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade