diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-05-01 18:54:18 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-05-01 19:08:37 +0100 |
| commit | bebc3653452c60e64e14a1a7d1b476ee75b2ae8a (patch) | |
| tree | e2e3b89d183c23fab20b95bb4ed59b0cc279a80f /README.rst | |
| parent | 888d37322643fd099008d76f12184648047d7204 (diff) | |
Add slurp support
Diffstat (limited to 'README.rst')
| -rw-r--r-- | README.rst | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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: |
