Skip to main content

Convert an Amazon Ion document(s) to JSON

Project description

pyion2json

Convert an Amazon Ion document(s) to JSON

Install

pip install pyion2json

Usage

Convert individual Ion values

import json
import amazon.ion.simpleion as ion
from pyion2json import ion_to_json

ion_doc = '{ first: "Tom" , last: "Riddle" }'
json_doc = ion_to_json(ion_doc)
print(json.dumps(json_doc, indent=' '))

Outputs:

{
 "first": "Tom",
 "last": "Riddle"
}

Convert a cursor from QLDB

from pyion2json import ion_cursor_to_json

with create_qldb_session() as qldb_session:
    qldb_cursor = qldb_session.execute_statement('SELECT first,last FROM Users')
    json_rows = ion_cursor_to_json(qldb_cursor)
    print(json.dumps(json_rows, indent=' '))

Outputs:

[
 {
  "first": "Harry",
  "last": "Potter"
 },
 {
  "first": "Tom",
  "last": "Riddle"
 }
]

TODO:

  1. Verify BLOB conversion meets expectations
  2. Verify CLOB conversion meets expectations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyion2json-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file pyion2json-0.0.1.tar.gz.

File metadata

  • Download URL: pyion2json-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5

File hashes

Hashes for pyion2json-0.0.1.tar.gz
Algorithm Hash digest
SHA256 228c69a7623bb7b4bf3a9f52790118e18c4dffc54a1320554eb82e5f1665411b
MD5 b5a5e868545112bc35fe90d3d808719c
BLAKE2b-256 890972fc6b48a0b551f4f5a9deb6504e85f7c9e5655ca4a0bae0cba6452083b4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page