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

Parsing JSON with array as root #6

Open
ebekker opened this issue May 5, 2017 · 1 comment
Open

Parsing JSON with array as root #6

ebekker opened this issue May 5, 2017 · 1 comment

Comments

@ebekker
Copy link

ebekker commented May 5, 2017

JSON input that starts with a root array is unparsable.

For example, start with input such as the JSON sample from here (the content of task-definitions/service.json).

You get the following error:
unable to parse HCL: At 1:1: expected: IDENT | STRING | ASSIGN | LBRACE got: LBRACK

@Acconut
Copy link
Collaborator

Acconut commented May 10, 2017

Unfortunately, this seems to be a limitation of the underlying parsing library (the official one from Hashicorp). From reading the corresponding source code, it's clear that they only accept objects as the root on purpose (see https://github.com/hashicorp/hcl/blob/master/json/parser/parser.go#L47-L48). However, it may be a good idea to open an issue about that in their repository.

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

2 participants