Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jackson YAML parser fails to load JSON files that use tabs for indentation #40

Open
andylowry opened this issue Sep 11, 2018 · 0 comments

Comments

@andylowry
Copy link
Contributor

The following shoudl be perfectly valid YAML, but the Jackson YAML parser fails to parse it:

{
	x: 1 # indentation is a tab character
}

YAML doesn't permit tabs in indentation in block content, but the initial open brace starts flow-style content, where initail indentation - including tabs - is supposed to be discarded.

To work around this, we now preprpocess file content to replace any string of tabs at the beginning of any line with an equal-length string of spaces. This has the nice feature that it does not alter column positions of values!

For JSON content, this will have no semantic impact, since indentations in JSON is always meaningless.

In YAML files, if the tabs appear in flow context this only changes ignored whitespace. In block content, it means the original YAML file was invalid, but assuming tabs were used consistently to indent the YAML, this change will preserve block levels and so might actually cause such files to be valid YAML.

andylowry added a commit that referenced this issue Sep 11, 2018
[#40] Replace tabs to work around jackson bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant