tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
14.1k stars 846 forks source link

Please consider adding result.Float32() and others #243

Closed petric3 closed 2 years ago

petric3 commented 2 years ago

Would it be possible to add, without overhead, types like float32 (result.Float32()), int16/32, uint16/32/... and others? JSON files are many times huge, on the other hand real world examples are within 2^31 values. Since in such cases memory matters, it may be reasonable to add them. Thanks for consideration..

tidwall commented 2 years ago

Hi petric3,

This has been discussed in other issues the past, and something that I'm considering, though I haven't decided on a clear path forward.

In the meantime this should work: x := float32(result.Float())