{"library":"amazon-ion","code":"import amazon.ion.simpleion as ion\n\n# Dump Python objects to Ion text or binary\ndata_py = {'id': 123, 'name': 'example', 'active': True}\nion_text = ion.dumps(data_py, binary=False, indent='  ')\nprint('Ion Text:\\n', ion_text)\n\nion_binary = ion.dumps(data_py, binary=True)\nprint('Ion Binary (bytes):', ion_binary)\n\n# Load Ion data back into Python objects\nloaded_py_text = ion.loads(ion_text)\nprint('Loaded from Text:', loaded_py_text)\n\nloaded_py_binary = ion.loads(ion_binary)\nprint('Loaded from Binary:', loaded_py_binary)\n\n# Example with a specific Ion type\nfrom datetime import datetime\nfrom amazon.ion.simple_types import IonPyTimestamp\ntimestamp_py = IonPyTimestamp(datetime(2023, 10, 27, 10, 30, 0))\nion_timestamp = ion.dumps({'event_time': timestamp_py}, binary=False)\nprint('Ion Timestamp:\\n', ion_timestamp)","lang":"python","description":"This quickstart demonstrates how to use the `simpleion` module to serialize Python dictionaries into Ion text and binary formats, and deserialize them back. It also shows how to work with Ion-specific types like `IonPyTimestamp`.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}