Mรณdulo 04 ยท Errors, Files & JSON โ Lecciรณn 3 de 3 ยท ~8 min
JSON
The wire format you already know
Back in Part I, your iOS app's Codable structs decoded JSON that came over the network โ {"id": 3, "name": "Rex"} turning into a Swift struct. That JSON came from a Python backend, and Python's json module is the other half of that same conversion.
Two functions, two directions:
json.loads(text)โ parse a JSON string into a Pythondict(loads = load from a string).json.dumps(data)โ convert a Pythondictback into a JSON string (dumps = dump to a string).