Skip to content

sjson.encode should use more digits in floating point numbers #3213

@pjsg

Description

@pjsg

Expected behavior

floating point numbers are represented in JSON as a value that is equivalent to the number

Actual behavior

Numbers like 1594863744.123456 appear as 1.594864e+09 -- which loses a lot of information.

Test code

> =sjson.encode({1594863744.123456})
[1.594864e+09]

NodeMCU startup banner

NodeMCU 3.0.0.0 built with Docker provided by frightanic.com
	branch: fix-spiffs-rw
	commit: 92cb1fb08fbbc9f478c13625e520b4a941805ad3
	release: 3.0-master_20200610 +13
	release DTS: 202007130331
	SSL: false
	build type: float
	LFS: 0x20000 bytes total capacity
	modules: adc,bit,crypto,encoder,enduser_setup,file,gpio,i2c,mdns,mqtt,net,node,rtcmem,rtctime,sjson,sntp,spi,tmr,uart,wifi
 build 2020-07-16 01:33 powered by Lua 5.3.5 on SDK 3.0.1-dev(fce080e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions