1
1
mirror of https://github.com/wader/fq.git synced 2024-12-01 02:30:32 +03:00
fq/format/msgpack/msgpack.jq

14 lines
438 B
Plaintext
Raw Normal View History

def _msgpack_torepr:
2022-01-10 14:18:10 +03:00
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
2022-01-10 14:18:10 +03:00
end
);
_f;