Marshall python objects to and from JSON

Pymarshaler Pymarshaler allows you to marshal and unmarshal any python object directly to and from a JSON formatted string. Pymarshaler takes advantage of python’s new typing support. By reading class init param types, we are able to walk down nested JSON structures and assign appropriate values. Basic Usage Declare a class with typing information class Test: def __init__(self, name: str): self.name = name That’s it! We can now marshal, and more importantly, unmarshal this object to and from JSON. from […]

Read more

A python library to convert arbitrary strings representing business opening hours into a JSON format

Python Opening Hours parser a python library to convert arbitrary strings representing business opening hours into a JSON format that’s easier to use in code This library parses opening hours from various human-readable strings such as “Mon- Fri 9:00am – 5:30pm” into a more standard JSON format that can be processed more easily. The format opening_hours = [ { “day”: “monday”, “opens”: “9:00”, “closes”: “17:00” }, //.. ] Installation pip install jsonify-opening-hours Usage The simplest example is just printing the […]

Read more

Declaratively specify how to extract elements from a JSON document with python

JMESPath JMESPath (pronounced “james path”) allows you to declaratively specify how to extract elements from a JSON document. For example, given this document: {“foo”: {“bar”: “baz”}} The jmespath expression foo.bar will return “baz”. JMESPath also supports: Referencing elements in a list. Given the data: {“foo”: {“bar”: [“one”, “two”]}} The expression: foo.bar[0] will return “one”. You can also reference all the items in a list using the * syntax: {“foo”: {“bar”: [{“name”: “one”}, {“name”: “two”}]}} The expression: foo.bar[*].name will return [“one”, […]

Read more

A simple and extensible JSON encoder/decoder for Python

simplejson simplejson is a simple, fast, complete, correct and extensible JSON http://json.org encoder and decoder for Python 3.3+ with legacy support for Python 2.5+. It is pure Python code with no dependencies, but includes an optional C extension for a serious speed boost. simplejson is the externally maintained development version of the json library included with Python (since 2.6). This version is tested with the latest Python 3.8 and maintains backwards compatibility with Python 3.3+ and the legacy Python 2.5 […]

Read more

A hyper-fast and safe Python module to read and write JSON data

hyperjson A hyper-fast, safe Python module to read and write JSON data. Works as a drop-in replacement for Python’s built-in json module. This is alpha software and there will be bugs, so maybe don’t deploy to production just yet. Installation pip install hyperjson Usage hyperjson is meant as a drop-in replacement for Python’s jsonmodule: >>> import hyperjson >>> hyperjson.dumps([{“key”: “value”}, 81, True]) ‘[{“key”:”value”},81,true]’ >>> hyperjson.loads(“””[{“key”: “value”}, 81, true]”””) [{u’key’: u’value’}, 81, True] Motivation Parsing JSON is a solved problem; so, […]

Read more
1 2 3