summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-07-06 16:40:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-07-06 16:40:27 -0700
commite12b6c208c0e591bc0feea52bf50fcad4e8e8b69 (patch)
tree6528a01b1be5e9781d730f7a17143994bba1ba26 /txr.1
parent2414f36adfae87c548d8b05e474c5ccda6df5fd6 (diff)
downloadtxr-e12b6c208c0e591bc0feea52bf50fcad4e8e8b69.tar.gz
txr-e12b6c208c0e591bc0feea52bf50fcad4e8e8b69.tar.bz2
txr-e12b6c208c0e591bc0feea52bf50fcad4e8e8b69.zip
json: support printing structs in JSON format.
* lib.c (out_json_sym): New static function. (out_json_rec): Handle structp. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.116
1 files changed, 16 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 53d3377b..bda03dcc 100644
--- a/txr.1
+++ b/txr.1
@@ -84092,6 +84092,22 @@ A list of object is rendered in the same way as vector, in the JSON
.code []
notation. When such JSON notation is parsed, a vector is produced.
+A structure object is rendered into JSON using the
+.code {}
+object notation. The keys of the objects are the names of the
+symbols of the object type's non-static slots, appearing as a
+string. The values are the values of the slots. They must be JSON-conforming
+objects.
+The first entry of the object is a key named
+.str __type
+whose value is the structure type symbol, appearing as a string.
+Both the slot symbols and the type symbol may appear with a package
+qualifier, depending on the relationship of the symbols to the current
+package, according to similar rules as if the symbol were printed
+by the
+.code print
+function.
+
When integer objects are output, they may not constitute valid JSON, since the
JSON specification supports only IEEE 64 bit floating-point numbers. JSON
numbers are read as floating-point.