1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 22:05:31 +03:00
fq/format/cbor/cbor.jq

14 lines
336 B
Plaintext
Raw Normal View History

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;