chickadee » medea » write-json

write-json datum #!optional portprocedure

Writes the given JSON datum to port which is (current-output-port) by default. datum's conversion to JSON is inferred by its Scheme type via the current json-unparsers parameter.

A common gotcha is that the default json-unparsers assume lists to be alists which are written as JSON objects. If you want to write a JSON array you need to pass a Scheme vector instead.