cheshire
cheshire copied to clipboard
Cheshire library not working for longer sequences
I have a sequence that contains more than 20 items, and I want to take 20 of those and convert them into json, so using Cheshire I do this:
(let [items (take 20 items-map)]
(prn (cheshire/generate-string
items
)
)
)
But this only works until take 10 or so, and after that there's no print at all. Why is this and what's the fix?
Can you share the data you're using? For example, this works just fine with me:
user=> (use 'cheshire.core)
nil
user=> (def l [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20])
#'user/l
user=> (encode l)
"[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]"
user=> (encode (take 20 l))
"[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]"
user=> (encode (take 5 l))
"[1,2,3,4,5]"
user=> (encode (take 10 l))
"[1,2,3,4,5,6,7,8,9,10]"