jeremyfa / yaml.js

Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.
MIT License
888 stars 141 forks source link

Unable to parse error for yaml file with indentation #57

Open lemmingworks opened 8 years ago

lemmingworks commented 8 years ago

https://raw.githubusercontent.com/companieshouse/api-enumerations/master/constants.yml

The following: yaml2json constants.yml > constants.json

resulted in the error: Unable to parse.

The yaml in the file has a single indent. Once un-indented it parsed fine. I'm not sure if this is the fault of the yaml file not meeting yaml specs.

Thanks for the useful module.

jonschlinkert commented 8 years ago

Is a single leading indent valid YAML? still, I was able to parse it fine. here is the result stringified to JSON: https://gist.github.com/jonschlinkert/a205b5be6ecfe084defb

jeremyfa commented 8 years ago

I believe it is valid YAML, but yes, it's not handled by yaml.js. I personally never had to parse such file but I will still fix it eventually as it's not the first time the issue is reported.

Thanks for the feedback!