1
1
mirror of https://github.com/wader/fq.git synced 2024-11-30 09:58:13 +03:00
fq/format/bson/bson.jq
Mattias Wadman 87b2c6c10c help,doc: Use markdown for format documentation again
Markdown is used as is in online documentation and in cli the markdown decoder
is used to decode and the some jq code massages it into something cli friendly.

Was just too much of a mess to have doc in jq.
2022-09-11 00:53:29 +02:00

20 lines
382 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
);