<commit_before>.. Jaccs documentation master file, created by
   sphinx-quickstart on Thu Dec 15 21:28:54 2016.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Jaccs - JSON Access Strings
===========================

Jaccs allows you to pull data from JSON objects using string Python
expressions. For example::

    >>> from jaccs import access
    >>> access({'a': 'b': [{'c': 1}, {'c': 2}]}, '_.a.b[1].c')
    2

This is expected to be most useful for combining specifications stored in
external text files (say JSON or YAML) with data objects in Python.

Installation
------------

The best way to install Jaccs is via PyPI::

    pip install jaccs

For the latest you can install from Github master with::

    pip install https://github.com/jiffyclub/jaccs/archive/master.zip

Access String Syntax
--------------------

Access strings must be valid Python expressions, and the result returned
by :py:func:`~jaccs.access` will be the result of calling
`eval <https://docs.python.org/3/library/functions.html#eval>`__
on the expression. The JSON object is represented by an underscore in
the expression. Jaccs wrapps the JSON object so that dictionary keys can
be accessed via attributes::

    >>> access({'a': {'b': 'z'}}, '_.a.b')
    'z'<commit_msg>Add Github link to docs<commit_after>.. Jaccs documentation master file, created by
   sphinx-quickstart on Thu Dec 15 21:28:54 2016.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Jaccs - JSON Access Strings
===========================

Jaccs allows you to pull data from JSON objects using string Python
expressions. For example::

    >>> from jaccs import access
    >>> access({'a': 'b': [{'c': 1}, {'c': 2}]}, '_.a.b[1].c')
    2

This is expected to be most useful for combining specifications stored in
external text files (say JSON or YAML) with data objects in Python.

Installation
------------

The best way to install Jaccs is via PyPI::

    pip install jaccs

For the latest you can install from Github master with::

    pip install https://github.com/jiffyclub/jaccs/archive/master.zip

Source code is on Github at https://github.com/jiffyclub/jaccs.

Access String Syntax
--------------------

Access strings must be valid Python expressions, and the result returned
by :py:func:`~jaccs.access` will be the result of calling
`eval <https://docs.python.org/3/library/functions.html#eval>`__
on the expression. The JSON object is represented by an underscore in
the expression. Jaccs wrapps the JSON object so that dictionary keys can
be accessed via attributes::

    >>> access({'a': {'b': 'z'}}, '_.a.b')
    'z'
{'fraction_non_alphanumeric': 0.13438300988648846, 'fraction_numerical': 0.012449652142072502, 'mean_word_length': 3.5609348914858097, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1918203', 'n_tokens_mistral': 817, 'n_tokens_neox': 775, 'n_words': 352}