1
1
mirror of https://github.com/wader/fq.git synced 2024-12-22 04:41:36 +03:00
fq/format/cbor/cbor.jq
2022-03-08 17:09:48 +01:00

11 lines
308 B
Plaintext

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;