1
1
mirror of https://github.com/wader/fq.git synced 2024-12-01 19:12:34 +03:00
fq/format/cbor/cbor.jq

11 lines
308 B
Plaintext
Raw Normal View History

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