From deeb507bfd23d4b547f49332ce216ff14db4308c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 19 Jun 2013 00:24:08 +0100 Subject: Add jq.string_to_json --- jq.pyx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'jq.pyx') 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 -- cgit v1.2.3