Using postgres-json with djula templating engine
Posted on September 3, 2015
by blasut
When trying to use postgres-json with djula, it’s a lot easier to using alists instead of vectors.
Original code for postgres-json is:
(defun from-json (string)
"Parse the JSON string STRING and return the resulting lisp object."
(yason:parse string :json-arrays-as-vectors t))
But change it to:
(defun from-json (string)
"Parse the JSON string STRING and return the resulting lisp object."
(yason:parse string))
And you have to rebind a global variable as well to use your new function:
(defparameter *from-json* #'from-json)
Add both of these to the same namespace in your project and it will be a lot easier to use.