-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve JSON output for Zed maps (#4589)
In JSON output, a Zed map becomes an array of {"key":KEY,"value":VALUE} objects. Change that to a single object object whose keys are ZSON representations of the map keys, as in {"KEY":VALUE}. * String keys are used directly. * Non-string primitive keys are converted to undecorated ZSON. * Union keys are untagged and then converted to ZSON (with decoration for uniqueness). * Enum keys are converted to their corresponding symbol. * All other keys are converted to ZSON. Closes #4567.
- Loading branch information
Showing
3 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
zed: '*' | ||
|
||
input: | | ||
|{}| | ||
// Primitive keys | ||
|{8(uint8):1}| | ||
|{16(uint16):1}| | ||
|{32(uint32):1}| | ||
|{64:1}| | ||
|{-8(int8):1}| | ||
|{-16(int16):1}| | ||
|{-32(int32):1}| | ||
|{-64:1}| | ||
|{1s:1}| | ||
|{1970-01-01T00:00:00Z:1}| | ||
|{16.(float16):1}| | ||
|{32.(float32):1}| | ||
|{64.:1}| | ||
|{false:1}| | ||
|{0x01020304:1}| | ||
|{"string":1}| | ||
|{1.2.3.4:1}| | ||
|{5.6.7.0/24:1}| | ||
|{<uint8>:1}| | ||
|{null:1}| | ||
// Complex keys | ||
|{{record:0}:1}| | ||
|{["array"]:1}| | ||
|{|["set"]|:1}| | ||
|{|{"map":0}|:1}| | ||
|{0:1,0(uint64):2,0(=t):3,"0":4}| | ||
|{%e0(enum(e0)):1}| | ||
|{error(0):1}| | ||
|{"named"(=t):1}| | ||
output-flags: -f json | ||
|
||
output: | | ||
{} | ||
{"8":1} | ||
{"16":1} | ||
{"32":1} | ||
{"64":1} | ||
{"-8":1} | ||
{"-16":1} | ||
{"-32":1} | ||
{"-64":1} | ||
{"1s":1} | ||
{"1970-01-01T00:00:00Z":1} | ||
{"16.":1} | ||
{"32.":1} | ||
{"64.":1} | ||
{"false":1} | ||
{"0x01020304":1} | ||
{"string":1} | ||
{"1.2.3.4":1} | ||
{"5.6.7.0/24":1} | ||
{"<uint8>":1} | ||
{"null":1} | ||
{"{record:0}":1} | ||
{"[\"array\"]":1} | ||
{"|[\"set\"]|":1} | ||
{"|{\"map\":0}|":1} | ||
{"0(uint64)":2,"0":1,"0(=t)":3,"\"0\"":4} | ||
{"e0":1} | ||
{"error(0)":1} | ||
{"named":1} |