
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/composition/eval_json.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_examples_composition_eval_json.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_composition_eval_json.py:

Transformer for evaluating json.lark

.. GENERATED FROM PYTHON SOURCE LINES 2-18

.. code-block:: default


    from lark import Transformer, v_args

    class JsonTreeToJson(Transformer):
        @v_args(inline=True)
        def string(self, s):
            return s[1:-1].replace('\\"', '"')

        array = list
        pair = tuple
        object = dict
        number = v_args(inline=True)(float)

        null = lambda self, _: None
        true = lambda self, _: True
        false = lambda self, _: False


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.000 seconds)


.. _sphx_glr_download_examples_composition_eval_json.py:


.. only :: html

 .. container:: sphx-glr-footer
    :class: sphx-glr-footer-example



  .. container:: sphx-glr-download sphx-glr-download-python

     :download:`Download Python source code: eval_json.py <eval_json.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

     :download:`Download Jupyter notebook: eval_json.ipynb <eval_json.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
