summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-09-29 21:25:59 +0100
committerMichael Williamson <mike@zwobble.org>2013-09-29 21:25:59 +0100
commit91844edc713e39ca2cbc1f2d7122e06bca1e653f (patch)
treed9d7440ddf81687793a0982ec56bd808a71f1ea9 /jq.pyx
parent0db42091514c60d9d6a09d77fb085c09376e1327 (diff)
Support Python 3.3
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx6
1 files changed, 3 insertions, 3 deletions
diff --git a/jq.pyx b/jq.pyx
index 6c568eb..ff95146 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -57,13 +57,13 @@ cdef class _Program(object):
string_input = input if raw_input else json.dumps(input)
bytes_input = string_input.encode("utf8")
result_bytes = self._string_to_strings(bytes_input)
- result_strings = result_bytes
+ result_strings = map(lambda s: s.decode("utf8"), result_bytes)
if raw_output:
return "\n".join(result_strings)
elif multiple_output:
- return map(json.loads, result_strings)
+ return [json.loads(s) for s in result_strings]
else:
- return json.loads(result_strings[0])
+ return json.loads(next(iter(result_strings)))
cdef object _string_to_strings(self, char* input):