json module provides functions for encoding and decoding JSON data.
Module Import
Encoding (Python to JSON)
dumps() - Serialize to String
dump() - Write to File
Decoding (JSON to Python)
loads() - Parse String
load() - Read from File
Type Mapping
| Python | JSON |
|---|---|
| dict | object |
| list, tuple | array |
| str | string |
| int, float | number |
| True | true |
| False | false |
| None | null |
Options
Practical Examples
Config File
API Response
pickle
Python object serialization
csv
CSV file handling
