This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Provides the DataModelDict class for creating, accessing and manipulating json/xml data structures.

Project Description

DataModelDict is a lightweight Python class for easy transformation and manipulation of JSON and XML structured data models. It is designed to take the best aspects of JSON, XML, and Python dictionaries to allow the user to interact with any of these formats in the same manner.

The code has no requirements that limit which systems it can be used on, i.e. it should work on Linux, Mac and Windows computers.

The latest release can be installed using pip:

pip install DataModelDict

The code and all documentation is hosted on GitHub and can be directly downloaded at https://github.com/usnistgov/DataModelDict.

Basic examples can be found in the Jupyter Notebook DataModelDict Basics.ipynb. Full documentation of the class methods can be found in Documentation.md.

The key features of DataModelDict (so far) are:

  1. It is a child of OrderedDict meaning that it has all the features one would expect of a Python dictionary.
  2. It has built-in conversion methods for reading and writing JSON and XML. JSON conversions use the standard Python json library and XML conversions use the xmltodict package.
  3. Numbers (int, float) and key terms (True, False, None) are recognized and converted during parsing.
  4. Methods for recusively searching the data model for specific keys and key-value pairs allow for the values and paths (as lists of indices) of elements to be easily found.
  5. Path lists can also be directly used to get and set values.
#These two return the exact same val.
val = my_model['a']['b']['c']['d']

path = ['a', 'b', 'c', 'd']
val = my_model[path]
  1. Additional methods for simplified handling of cases where XML does not directly map to JSON and Python dictionaries.

DataModelDict works by parsing in a JSON or XML data model such that every dictionary level is an instance of DataModelDict. This allows for the conversion and functional methods to be callable both on the full model and on subcomponents.

Release History

Release History

This version
History Node

0.8

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
DataModelDict-0.8.zip (9.7 kB) Copy SHA256 Checksum SHA256 Source Mar 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting