Skip to content

Commit

Permalink
Makes JSON decoder use Number when ungronning; fixes #12
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnomnom committed Aug 15, 2016
1 parent eb6189f commit 86fbc91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func (ss statements) Swap(i, j int) {
ss[i], ss[j] = ss[j], ss[i]
}

// ungron turns statements into a proper datastructur
// ungron turns statements into a proper datastructure
func (ss statements) ungron() (interface{}, error) {

// Get all the idividually parsed statements
// Get all the individually parsed statements
var parsed []interface{}
for _, s := range ss {
l := newLexer(s)
Expand Down
4 changes: 3 additions & 1 deletion ungron.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ func ungronTokens(ts []token) (interface{}, error) {

case typValue:
var val interface{}
err := json.Unmarshal([]byte(t.text), &val)
d := json.NewDecoder(strings.NewReader(t.text))
d.UseNumber()
err := d.Decode(&val)
if err != nil {
return nil, fmt.Errorf("failed to handle quoted key `%s`", t.text)
}
Expand Down

0 comments on commit 86fbc91

Please sign in to comment.