1
1
mirror of https://github.com/wader/fq.git synced 2024-12-01 02:30:32 +03:00
fq/format/bson/bson.jq

19 lines
381 B
Plaintext
Raw Normal View History

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
);