javascript - JSON stringify conversion of float to int -


i using node.js , built-in json object stringify json object. in object is

{      weight : 1.0 } 

however when stringify , write file output weight : 1.

actually yours not issue , 1 == 1.0 == 1.00 in javascript , if have float value 1.55 stringify gives same 1.55 not 1.. if want 1.0 written , change value string

i mean enclose value in double quotes

{      weight : "1.0" } 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -