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

Trailing comment in YAML causes Error marshaling to json: invalid character '}' looking for beginning of object key string when output type is JSON #1646

Open
NiklasRosenstein opened this issue Oct 9, 2024 · 2 comments · May be fixed by #1647

Comments

@NiklasRosenstein
Copy link

Sops v3.9.1

To reproduce:

$ echo -e 'foo: bar\n#Hello world' | sops --input-type yaml --output-type yaml -e /dev/stdin > test.yaml
$ sops -d test.yaml 
foo: bar
#Hello world
$ sops --output-type json --decrypt --input-type yaml test.yaml 
Error dumping file: Error marshaling to json: invalid character '}' looking for beginning of object key string
@felixfontein
Copy link
Contributor

Thanks for reporting this!

I just tested this with 3.9.0, there it also happens. So at least it's not a regression introduced in 3.9.1 😅

@felixfontein
Copy link
Contributor

The JSON serializer handles comments at the end of lists or maps pretty badly, which is causing this; I've created #1647 to fix this.

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

Successfully merging a pull request may close this issue.

2 participants