Skip to main content
July 29, 2011
Question

Serialiaze Json gives exponential value

  • July 29, 2011
  • 1 reply
  • 872 views

Hi,

          While am trying to serialiaze a numeric value, it appends ".0" at the end. In addition, if there are more than 7 digits, it seems to append some exponential character.

Example:

<cfset stc_test['add'] = 1234567/>
<cfset t1 =  serializejson(stc_test)/>
<cfdump var="#t1#">

Result:
{"add":1234567.0}

<cfset stc_test['add'] = 12345678/>
<cfset t1 =  serializejson(stc_test)/>
<cfdump var="#t1#">

Result:
{"add":1.2345678E7}

How can I avoid this?

    This topic has been closed for replies.

    1 reply

    Owainnorth
    Inspiring
    July 29, 2011

    What version of CF are you running? If it's CF9 I'm pretty sure this is one of the issues that was fixed by the CFH1 update, or maybe 9.0.1.

    I'm running CF9.0.1 with the CFH1, and I get this:

    {"add":1234567}

    {"add":12345678}

    So apply the updates and it'll fix itself

    July 29, 2011

    I am using coldfusion 8

    Owainnorth
    Inspiring
    July 29, 2011

    Riiiiight and have you applied all the patches...?