tomnomnom/gron · error
JSON internal error
Error message
JSON internal error
What it means
While converting a decoded JSON document into Gron statement tokens, json.Marshal failed on a float64 array element (or on the statement's value) — types that JSON encoding must always support. The wrap message marks this as an internal invariant violation, not bad user input, since the value originated from successful json.Unmarshal decoding.
Solutions
- Investigate the wrapped json.Marshal error; a failure here indicates corrupted or impossible in-memory state
- Verify the input decoding path produces only standard JSON-encodable values (float64, string, bool, nil, arrays, maps)
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at statements.go:214 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tomnomnom/gron@88a6234ea2 (2026-09-06).
Data as JSON: /api/errors/11ee6115435be432.
Report an issue: GitHub.
Appendix: source
Thrown at statements.go:214
v = a[1]
a, ok = a[0].([]interface{})
if !ok {
goto out
}
// We'll append one initial token, then 3 tokens for each element of a,
// then 3 closing tokens, that's alltogether 3*len(a)+4.
s = make(statement, 0, 3*len(a)+4)
s = append(s, token{"json", typBare})
for _, e := range a {
s = append(s, token{"[", typLBrace})
switch e := e.(type) {
case string:
s = append(s, token{quoteString(e), typQuotedKey})
case float64:
nbuf, err = json.Marshal(e)
if err != nil {
return nil, errors.Wrap(err, "JSON internal error")
}
nstr = string(nbuf)
s = append(s, token{nstr, typNumericKey})
default:
ok = false
goto out
}
s = append(s, token{"]", typRBrace})
}
s = append(s, token{"=", typEquals})
switch v := v.(type) {
case bool:
if v {
t = typTrue
} else {
t = typFalseView on GitHub (pinned to 88a6234ea2)