From 0ffe91235db4bdc132329599d8d434bc53d3b951 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 28 Mar 2014 14:45:55 +0000 Subject: Use README.rst instead of README.md --- README.rst | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 README.rst (limited to 'README.rst') diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ac66f30 --- /dev/null +++ b/README.rst @@ -0,0 +1,52 @@ +jq.py: a lightweight and flexible JSON processor +================================================ + +Warning: the API is not stable. + +This project contains Python bindings for +`jq `_. + +Examples +-------- + +.. code-block:: python + + from jq import jq + + jq(".").transform("42") == "42" + +If the value is unparsed JSON text, pass it in using the ``text`` +argument: + +.. code-block:: python + + jq(".").transform(text="42") == 42 + +The ``text_output`` argument can be used to serialise the output into +JSON text: + +.. code-block:: python + + jq(".").transform("42", text_output=True) == '"42"' + +If there are multiple output elements, each element is represented by a +separate line, irrespective of the value of ``multiple_output``: + +.. code-block:: python + + jq(".[]").transform("[1, 2, 3]", text_output=True) == "1\n2\n3" + +If ``multiple_output`` is ``False`` (the default), then the first output +is used: + +.. code-block:: python + + jq(".[]+1").transform([1, 2, 3]) == 2 + +If ``multiple_output`` is ``True``, all output elements are returned in +an array: + +.. code-block:: python + + jq(".[]+1").transform([1, 2, 3], multiple_output=True) == [2, 3, 4] + -- cgit v1.2.3