mirror of
https://github.com/wader/fq.git
synced 2024-12-03 01:33:02 +03:00
149cb3f45a
Ex: fq -d msgpack torepr file.msgpack Willoutput the JSON representation of the msgpack Make per format *_torepr functions internal
14 lines
365 B
Plaintext
14 lines
365 B
Plaintext
def _bencode_torepr:
|
|
def _f:
|
|
if .type == "string" then .value | tovalue
|
|
elif .type == "integer" then .value | tovalue
|
|
elif .type == "list" then .values | map(_f)
|
|
elif .type == "dictionary" then
|
|
( .pairs
|
|
| map({key: (.key | _f), value: (.value | _f)})
|
|
| from_entries
|
|
)
|
|
else error("unknown type \(.type)")
|
|
end;
|
|
_f;
|