- printer VALUEprocedure
Prints VALUE as JSON text, using the same value mapping described above -- VALUE can be any JSON value: an association list, a vector, a string, a number, #t, #f, or the symbol 'null. On a value printer cannot print, prints an error message to the current output port and returns "".
(import json-abnf) (define person (list (cons "name" "Ada") (cons "tags" (vector "mathematician" "programmer")))) (printer person) ;; => "{\"name\":\"Ada\",\"tags\":[\"mathematician\",\"programmer\"]}" (parser (printer person)) ;; => (("name" . "Ada") ("tags" . #("mathematician" "programmer"))) ;; A document doesn't need to be an object or an array (parser "42") ;; => 42 (printer "hello") ;; => "\"hello\""