diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-05-01 17:54:08 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-05-01 17:54:08 +0100 |
| commit | 69804ec9a5ffdf742ed6ca868062f3c8fa67e11f (patch) | |
| tree | 82a84058e58ba310aff3a57b254b3970f0d81634 /jq.pyx | |
| parent | 1bf642c6a1ef244131d37b9764a7493c8e1c5648 (diff) | |
Support multiple input values
Diffstat (limited to 'jq.pyx')
| -rw-r--r-- | jq.pyx | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1,3 +1,4 @@ +import io import json import threading @@ -255,6 +256,13 @@ cdef class _Program(object): def input_value(self, value): return self.input_text(json.dumps(value)) + def input_values(self, values): + fileobj = io.StringIO() + for value in values: + json.dump(value, fileobj) + fileobj.write("\n") + return self.input_text(fileobj.getvalue()) + def input_text(self, text): return _ProgramWithInput(self._jq_state_pool, text.encode("utf8")) |
