mirror of
https://github.com/wader/fq.git
synced 2024-12-03 13:46:37 +03:00
149cb3f45a
Ex: fq -d msgpack torepr file.msgpack Willoutput the JSON representation of the msgpack Make per format *_torepr functions internal
19 lines
381 B
Plaintext
19 lines
381 B
Plaintext
def _bson_torepr:
|
|
def _f:
|
|
( if .type == null or .type == "array" then
|
|
( .value.elements
|
|
| map(_f)
|
|
)
|
|
elif .type == "document" then
|
|
( .value.elements
|
|
| map({key: .name, value: _f})
|
|
| from_entries
|
|
)
|
|
elif .type == "boolean" then .value != 0
|
|
else .value | tovalue
|
|
end
|
|
);
|
|
( {type: "document", value: .}
|
|
| _f
|
|
);
|