mirror of
https://github.com/wader/fq.git
synced 2024-12-25 14:23:18 +03:00
cae288e6be
json, yaml, toml, xml, html, csv are now normal formats and most of them also particiate in probing (not html and csv). Also fixes a bunch of bugs in to/fromxml, to/fromjq etc.
72 lines
1.3 KiB
Plaintext
72 lines
1.3 KiB
Plaintext
/probe.toml:
|
|
[test]
|
|
key = 123
|
|
$ fq . probe.toml
|
|
{
|
|
"test": {
|
|
"key": 123
|
|
}
|
|
}
|
|
# toml does not support null in arrays
|
|
# TODO: add uint64 norm test
|
|
$ fq -rRs 'fromjson[] | (walk(if type == "array" then map(select(. != null)) end) | try (totoml | ., fromtoml) catch .), "----"' variants.json
|
|
totoml cannot be applied to: null
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
array = [true, false, 1.2, "string", [1.2, 3], {a = 1}]
|
|
"escape \\\"" = 456
|
|
false = false
|
|
number = 1.2
|
|
string = "string"
|
|
true = true
|
|
"white space" = 123
|
|
|
|
[object]
|
|
a = 1
|
|
|
|
{
|
|
"array": [
|
|
true,
|
|
false,
|
|
1.2,
|
|
"string",
|
|
[
|
|
1.2,
|
|
3
|
|
],
|
|
{
|
|
"a": 1
|
|
}
|
|
],
|
|
"escape \\\"": 456,
|
|
"false": false,
|
|
"number": 1.2,
|
|
"object": {
|
|
"a": 1
|
|
},
|
|
"string": "string",
|
|
"true": true,
|
|
"white space": 123
|
|
}
|
|
----
|
|
toml: top-level values must be Go maps or structs
|
|
----
|
|
|
|
error at position 0x0: root object has no values
|
|
----
|
|
$ fq -n '"" | fromtoml'
|
|
exitcode: 5
|
|
stderr:
|
|
error: error at position 0x0: root object has no values
|