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

missing fields when decoding JSON #152

Merged
merged 7 commits into from
Sep 16, 2016
Merged

missing fields when decoding JSON #152

merged 7 commits into from
Sep 16, 2016

Conversation

jbardin
Copy link
Member

@jbardin jbardin commented Sep 13, 2016

A single JSON object with a single key and value of a another object fails to decode.

A JSON object with a single entry containing a single object fails to
decode.
@jbardin
Copy link
Member Author

jbardin commented Sep 13, 2016

This will fix #153

Remove a level of nesting and separate the passing and failing cases.
A single json object with nested objects is flattened by the json parser
to a list of objects sharing the parent key. If we're decoding into
struct this was likely a mistake, and we need to re-expand the ast.
@jbardin jbardin changed the title [WIP] missing fields when decoding JSON missing fields when decoding JSON Sep 15, 2016
@jbardin jbardin changed the title missing fields when decoding JSON [WIP] missing fields when decoding JSON Sep 15, 2016
@jbardin jbardin changed the title [WIP] missing fields when decoding JSON missing fields when decoding JSON Sep 15, 2016
@jbardin
Copy link
Member Author

jbardin commented Sep 15, 2016

All tests green! 🍏

@mitchellh
Copy link
Contributor

Looks really great! :D

Make TestDecode_flattenedJSON table driven to add more test cases as
reproduced in terraform.
Now that we know only individual items in a slice need to be expanded,
we can simplify the code flow to expand the ast in place while decoding.
@jbardin
Copy link
Member Author

jbardin commented Sep 16, 2016

rebased in some spelling/comment fixes.

@jbardin jbardin merged commit ef8133d into master Sep 16, 2016
@jbardin jbardin deleted the jbardin/undecoded branch September 16, 2016 13:01
jbardin added a commit that referenced this pull request Oct 14, 2016
missing fields when decoding JSON
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 this pull request may close these issues.

None yet

2 participants