prop

Library for parsing JSON lines.


Keywords
prop, attr, dot, object, dict, list, library, python
License
MIT
Install
pip install prop==0.0.2

Documentation

prop · py

Pypi Version Build Status Code coverage Python ver

A Python 🐍 library for getting a property from a nested object using a dot path.

Usage

import prop

data = {
    'k1': 'v1',
    'nested': {'x': 'y', 'int': 0, 'null': None},
    'list': [[None, True, 9]]
}

prop.get(data, 'k1')
# v1

prop.get(data, 'nested.x')
# x

prop.get(data, 'list.0.1')
# True

prop.get(data, 'list.0.-1')
# 9

Limitations: For navigating dicts, only string keys are supported.

Installation

$ pip install prop

Similar libraries

License

MIT © Cristi Constantin.