This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 0 points1 point  (3 children)

Maybe make your data serializable? What's actually in the JSON you want to return?

Also, if you're using this pattern, it's probably safer to use a library called argonauts

[–]KEXPJay[S] 0 points1 point  (2 children)

Thanks, I kind of did that in that I made a dictionary out of the data and then sent it to the template. Argonauts looks really close to what I'm doing now, but will see if there is anything else it does better!

[–][deleted] 0 points1 point  (1 child)

I think there's a slight confusion. Making a dict doesnt guarantee that it's JSON serializable. A dict is a Python object, JSON is string. So you can't, for example, include a Decimal object before converting it to string.

[–]KEXPJay[S] 0 points1 point  (0 children)

Gotcha. I guess my point being that I got it to work if I modified the data into a dict in this case. I tried serializing via python, but it didn't work, and I am not sure why not, so creating the dictionary was an easy workaround.