From bebc3653452c60e64e14a1a7d1b476ee75b2ae8a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 1 May 2023 18:54:18 +0100 Subject: Add slurp support --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'README.rst') diff --git a/README.rst b/README.rst index aa8cf49..15b7087 100644 --- a/README.rst +++ b/README.rst @@ -99,6 +99,15 @@ Call ``.input_text()`` to supply unparsed JSON text: assert jq.compile(".").input_text("0.42").first() == 0.42 assert jq.compile(".").input_text("true").first() == True assert jq.compile(".").input_text('"hello"').first() == "hello" + assert jq.compile(".").input_text("1\n2\n3").all() == [1, 2, 3] + +Pass ``slurp=True`` to ``.input_text()`` to read the entire input into an array: + +.. code-block:: python + + import jq + + assert jq.compile(".").input_text("1\n2\n3", slurp=True).first() == [1, 2, 3] You can also call the older ``input()`` method by passing: -- cgit v1.2.3