google / google/gson

On special float value error, provide path in object

Open
#662 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

When serializing objects, I sometimes get the special float value error because of a `NaN` or `Infinity`. It's expected, but the error message, while accurate, doesn't specify where in my object is the offending value.

Having the full path (e.g. `l1obj.l2obj.l3arr[27].offending`) in the error message would be a great help when dealing with complex objects. If not possible, then at least the last key / index would be better than nothing.

What do you think?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.