From 69804ec9a5ffdf742ed6ca868062f3c8fa67e11f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Mon, 1 May 2023 17:54:08 +0100 Subject: Support multiple input values --- jq.pyx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'jq.pyx') diff --git a/jq.pyx b/jq.pyx index a280687..15882ad 100644 --- a/jq.pyx +++ b/jq.pyx @@ -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")) -- cgit v1.2.3