YAML as a JSON superset and TAB characters

前端 未结 3 887
花落未央
花落未央 2021-02-14 04:20

I am unable to find a reference to this error exactly, but YAML 1.2 says it\'s a JSON superset, and if I use tab characters in a JSON it treats it like an error.

e.g.

3条回答
  •  轮回少年
    2021-02-14 04:36

    According to specification tabs were never allowed. So, when JSON is used inside YAML, it is not allowing tabs.

    The problem occurs when we think JSON as a pure subset of YAML. But it is not, according to Relation to JSON section in specification, there are some little things, that keeps json from being a pure subset of YAML.

    If we are to address those dissimilarities, what we will need is something like YSON, which is also mentioned in the spec.

    But fortunately there are some YAML engines that support tabs as indentations. Snakeyml is an example for that.

提交回复
热议问题