summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-10-11 20:47:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-10-11 20:47:27 -0700
commitaa02bc7f31edabb9e09f9756d7ae8fbc41995017 (patch)
tree60bd97475501b9c8484f3804a5ac5d409113d373 /txr.1
parent5df51b54116d4287df161c42ca0edb16fb1f79a5 (diff)
downloadtxr-aa02bc7f31edabb9e09f9756d7ae8fbc41995017.tar.gz
txr-aa02bc7f31edabb9e09f9756d7ae8fbc41995017.tar.bz2
txr-aa02bc7f31edabb9e09f9756d7ae8fbc41995017.zip
json: support standard-style formatting.
* stream.c (standard_k, print_json_format_s): New symbol variables. (stream_init): New variables initialized. * stream.h (enum json_fmt): New enum. (standard_k, print_json_format_s): Declared. * lib.c (out_json_rec): Take enum json_fmt param, and pass it recursively. Printing for vector and dictionaries reacts to argument value. (out_json, put_json): Examine value of special var *print-json-format* and calculate enum json_fmt value from this. Pass to out_json_rec. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.123
1 files changed, 23 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index be539219..846c35d4 100644
--- a/txr.1
+++ b/txr.1
@@ -79981,6 +79981,29 @@ argument is passed to that function, defaulting to
The value returned is that of
.codn put-jsons .
+.coNP Variable @ *print-json-format*
+.desc
+The
+.code *print-json-format*
+variable controls the formatting style exhibited by
+.code put-json
+and related functions. The initial value of this variable is
+.codn nil .
+
+If the value is the keyword symbol
+.codn :standard ,
+then a widely-used format is used, in which the opening and closing
+braces and brackets of vectors and dictionaries are printed
+on separate lines, as are the elements of those objects.
+
+If the variable
+has any other value, including the initial value
+.codn nil ,
+then a default format is used in which braces, brackets
+and elements appear on the same line, subject to automatic
+breaking and indentation, similar to the way Lisp nested
+list structure is printed.
+
.coNP Variable @ *read-bad-json*
.desc
This dynamic variable, initialized to a value of