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

18 lines
460 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;
def _cbor__help:
{ links: [
{url: "https://en.wikipedia.org/wiki/CBOR"},
{url: "https://www.rfc-editor.org/rfc/rfc8949.html"}
]
};