summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-06-19 00:24:08 +0100
committerMichael Williamson <mike@zwobble.org>2013-06-19 00:24:08 +0100
commitdeeb507bfd23d4b547f49332ce216ff14db4308c (patch)
treeecef14c607473b4dd5e36ebe47a770831f94508e /jq.pyx
parent736d9f8a23e48559cad7076851db1c1c5b891532 (diff)
Add jq.string_to_json
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx6
1 files changed, 6 insertions, 0 deletions
diff --git a/jq.pyx b/jq.pyx
index 55408b4..2fabf60 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -1,3 +1,5 @@
+import json
+
cdef extern from "jv.h":
ctypedef struct jv:
pass
@@ -55,6 +57,10 @@ def string_to_string(char* program, char* input):
return "".join(results)
+def string_to_json(char* program, char* input):
+ return json.loads(string_to_string(program, input))
+
+
cdef process(jq_state *jq, jv value):
cdef int jq_flags = 0