1
1
mirror of https://github.com/wader/fq.git synced 2024-11-27 14:14:58 +03:00
fq/format/cbor/cbor.jq
Mattias Wadman 0b0f28e966 cbor: Add decoder
Does not decode sematic tag types
Also fixes broken float16 support

Fixes #71
2022-01-12 17:56:03 +01:00

14 lines
336 B
Plaintext

def _cbor_torepr:
def _f:
( if .major_type == "map" then
( .pairs
| map({key: (.key | _f), value: (.value | _f)})
| from_entries
)
elif .major_type == "array" then .elements | map(_f)
elif .major_type == "bytes" then .value | tostring
else .value | tovalue
end
);
_f;