mirror of
https://github.com/wader/fq.git
synced 2024-12-26 15:02:28 +03:00
149cb3f45a
Ex: fq -d msgpack torepr file.msgpack Willoutput the JSON representation of the msgpack Make per format *_torepr functions internal
14 lines
438 B
Plaintext
14 lines
438 B
Plaintext
def _msgpack_torepr:
|
|
def _f:
|
|
( if .type | . == "fixmap" or . == "map16" or . == "map32" then
|
|
( .pairs
|
|
| map({key: (.key | _f), value: (.value | _f)})
|
|
| from_entries
|
|
)
|
|
elif .type | . == "fixarray" or . == "array16" or . == "array32" then .elements | map(_f)
|
|
elif .type | . == "bin8" or . == "bin16" or . == "bin32" then .value | tostring
|
|
else .value | tovalue
|
|
end
|
|
);
|
|
_f;
|