@@ -26,9 +26,9 @@ CompositeTypeWrapper(x) = CompositeTypeWrapper(x, propertynames(x))
26
26
lower(x)
27
27
28
28
Return a value of a JSON-encodable primitive type that `x` should be lowered
29
- into before encoding as JSON. Supported types are: `AbstractDict` to JSON
30
- objects, `Tuple` and `AbstractVector` to JSON arrays, `AbstractArray` to nested
31
- JSON arrays, `AbstractString`, `Symbol`, `Enum`, or `Char` to JSON string,
29
+ into before encoding as JSON. Supported types are: `AbstractDict` and `NamedTuple`
30
+ to JSON objects, `Tuple` and `AbstractVector` to JSON arrays, `AbstractArray` to
31
+ nested JSON arrays, `AbstractString`, `Symbol`, `Enum`, or `Char` to JSON string,
32
32
`Integer` and `AbstractFloat` to JSON number, `Bool` to JSON boolean, and
33
33
`Nothing` to JSON null, or any other types with a `show_json` method defined.
34
34
265
265
show_json (io:: SC , :: CS , :: Nothing ) = show_null (io)
266
266
show_json (io:: SC , :: CS , :: Missing ) = show_null (io)
267
267
268
- function show_json (io:: SC , s:: CS , a :: AbstractDict )
268
+ function show_json (io:: SC , s:: CS , x :: Union{ AbstractDict, NamedTuple} )
269
269
begin_object (io)
270
- for kv in a
270
+ for kv in pairs (x)
271
271
show_pair (io, s, kv)
272
272
end
273
273
end_object (io)
0 commit comments