Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cblp/yaml-sucks
YAML sucks.
https://github.com/cblp/yaml-sucks
Last synced: 6 days ago
JSON representation
YAML sucks.
- Host: GitHub
- URL: https://github.com/cblp/yaml-sucks
- Owner: cblp
- Created: 2015-07-07T14:44:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-05T16:25:02.000Z (6 months ago)
- Last Synced: 2024-11-29T18:49:23.645Z (14 days ago)
- Language: Shell
- Homepage:
- Size: 33.2 KB
- Stars: 614
- Watchers: 8
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- stars - cblp/yaml-sucks
README
# YAML sucks.
YAML specification is so ambiguous,
that you can't be sure if tomorrow you will parse the same data from YAML file
as you have yesterday.Let's see how different implementations parse YAML code.
Settings are default or near to default or typical for that language.
We use JSON to represent data the uniform way.YAML source
yaml2json.hs
yaml2json.pl
yaml2json.py
yaml2json.rb
rq- false
- n
- off[
false,
false,
false
][
"",
"n",
"off"
][
false,
"n",
false
][
false,
"n",
false
][
false,
"n",
"off"
]no: "foo"
{
"no": "foo"
}{
"no" : "foo"
}{
"false": "foo"
}{
"false": "foo"
}{
"no": "foo"
}- 0:00
- 01:00
- 12:34[
"0:00",
"01:00",
"12:34"
][
"0:00",
"01:00",
"12:34"
][
"0:00",
"01:00",
754
][
0,
3600,
45240
][
"0:00",
"01:00",
"12:34"
]null
null
null
false
:x:
[ERROR] [rq] Encountered: YAML error
[ERROR] [rq] Caused by: EOF while parsing a value
[ERROR] [rq] (Re-run with --trace or RUST_BACKTRACE=1 for a backtrace)- -.inf
- .NaN[
"-.inf",
".NaN"
][
"-.inf",
".NaN"
][
-Infinity,
NaN
]:x:
/usr/lib/ruby/2.5.0/json/common.rb:286:in `generate': 862: -Infinity not allowed in JSON (JSON::GeneratorError)
from /usr/lib/ruby/2.5.0/json/common.rb:286:in `pretty_generate'
from ./yaml2json.rb:6:in `'[
null,
null
]- 1.23015e+3
- 12.3015e+02
- 1230.15[
1230.15,
1230.15,
1230.15
][
"1.23015e+3",
"12.3015e+02",
"1230.15"
][
1230.15,
1230.15,
1230.15
][
1230.15,
1230.15,
1230.15
][
1230.15,
1230.15,
1230.15
]0xC
"0xC"
"0xC"
12
12
12
<<
"<<"
"<<"
:x:
ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:merge'
in "", line 1, column 1"<<"
"<<"
<<: {}
{}
{
"<<" : {}
}{}
{
}{
"<<": {}
}"<<": {}
{}
{
"<<" : {}
}{
"<<": {}
}{
}{
"<<": {}
}<<: a
{
"<<": "a"
}{
"<<" : "a"
}:x:
ConstructorError: while constructing a mapping
in "", line 1, column 1
expected a mapping or list of mappings for merging, but found scalar
in "", line 1, column 5{
"<<": "a"
}{
"<<": "a"
}a: &alias
k1: v1
k2: v2b:
<<: *alias
k1: override
k3: v3{
"a": {
"k2": "v2",
"k1": "v1"
},
"b": {
"k3": "v3",
"k2": "v2",
"k1": "override"
}
}{
"a" : {
"k2" : "v2",
"k1" : "v1"
},
"b" : {
"k1" : "override",
"k3" : "v3",
"<<" : {
"k2" : "v2",
"k1" : "v1"
}
}
}{
"a": {
"k1": "v1",
"k2": "v2"
},
"b": {
"k1": "override",
"k2": "v2",
"k3": "v3"
}
}{
"a": {
"k1": "v1",
"k2": "v2"
},
"b": {
"k1": "override",
"k2": "v2",
"k3": "v3"
}
}{
"a": {
"k1": "v1",
"k2": "v2"
},
"b": {
"<<": {
"k1": "v1",
"k2": "v2"
},
"k1": "override",
"k3": "v3"
}
}- 1000
- +1000
- 1_000[
1000,
1000,
"1_000"
][
"1000",
"+1000",
"1_000"
][
1000,
1000,
1000
][
1000,
1000,
1000
][
1000,
1000,
"1_000"
][8, 08, 0o10, 010]
[
8,
8,
"0o10",
10
][
"8",
"08",
"0o10",
"010"
][
8,
"08",
"0o10",
8
][
8,
"08",
"0o10",
8
][
8,
8,
8,
10
]"Sosa did fine.\u263A"
"Sosa did fine.☺"
"Sosa did fine.☺"
"Sosa did fine.\u263a"
"Sosa did fine.☺"
"Sosa did fine.☺"