<commit_before>jsonobjects
==============

``jsonobjects`` allows you to declaratively specify how to extract and convert elements from a JSON document.


Installation
------------
We recommend the use of `virtualenv <https://virtualenv.pypa.io/>`_ and of
`pip <https://pip.pypa.io/>`_. You can then use ``pip install -U jsonobjects``.
You may also have `setuptools <http://peak.telecommunity.com/DevCenter/setuptools>`_ and thus
you can use ``easy_install -U jsonobjects``. Otherwise, you can download the
source from `GitHub <http://github.com/caxap/jsonobjects>`_ and run ``python
setup.py install``.


Dependencies
------------
All dependencies are optional.

- `JMESPath <https://jmespath.readthedocs.org/en/latest/>`_ to allow advanced queries
(see `JMESPath <https://jmespath.readthedocs.org/en/latest/>`_ documentation for details).


Usage
-----

Example of schema to parse iTunes lookup response for software item:

.. code:: python

    import json
    import requests
    import jsonobjects as jo


    class iTunesAppSchema(jo.Schema):
        id = jo.IntegerField('trackId')
        url = jo.Field('trackViewUrl')
        name = jo.StringField('trackName')
        currency = jo.StringField()
        price = jo.FloatField(min_value=0.0)
        rating = jo.FloatField('averageUserRating')
        reviews = jo.IntegerField('userRatingCountForCurrentVersion')<commit_msg>Added `dateutil` to README.<commit_after>jsonobjects
==============

``jsonobjects`` allows you to declaratively specify how to extract and convert elements from a JSON document.


Installation
------------
We recommend the use of `virtualenv <https://virtualenv.pypa.io/>`_ and of
`pip <https://pip.pypa.io/>`_. You can then use ``pip install -U jsonobjects``.
You may also have `setuptools <http://peak.telecommunity.com/DevCenter/setuptools>`_ and thus
you can use ``easy_install -U jsonobjects``. Otherwise, you can download the
source from `GitHub <http://github.com/caxap/jsonobjects>`_ and run ``python
setup.py install``.


Dependencies
------------
All dependencies are optional.

- `JMESPath <https://jmespath.readthedocs.org/en/latest/>`_ to allow advanced queries (see `JMESPath <https://jmespath.readthedocs.org/en/latest/>`_ documentation for details).
- `dateutil <https://dateutil.readthedocs.org/en/latest/>`_ to allow iso-8601 date formats.


Usage
-----

Example of schema to parse iTunes lookup response for software item:

.. code:: python

    import json
    import requests
    import jsonobjects as jo


    class iTunesAppSchema(jo.Schema):
        id = jo.IntegerField('trackId')
        url = jo.Field('trackViewUrl')
        name = jo.StringField('trackName')
        currency = jo.StringField()
        price = jo.FloatField(min_value=0.0)
        rating = jo.FloatField('averageUserRating')
        reviews = jo.IntegerField('userRatingCountForCurrentVersion')
{'fraction_non_alphanumeric': 0.1383866481223922, 'fraction_numerical': 0.0027816411682892906, 'mean_word_length': 3.573926868044515, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1613070', 'n_tokens_mistral': 882, 'n_tokens_neox': 823, 'n_words': 249}