Highlighted

returnformat = JSON

Participant ,
Apr 20, 2015

Copy link to clipboard

Copied

I have some fields that are varchar, however, they have numbers in them.  JSON does not return them inside quotation marks because it is interpreting it as a number.  Real numbers do not work, either.  Is there a workaround?

<cffunction name="jqgridCP" access="remote" returnformat="json">

I'm trying to populate a cfgrid with data from a cfquery.  The fields that have numbers as data (not all do) but are varchar in the database return empty cells.

It appears to be adding .0 to the numbers.

Views

219

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

returnformat = JSON

Participant ,
Apr 20, 2015

Copy link to clipboard

Copied

I have some fields that are varchar, however, they have numbers in them.  JSON does not return them inside quotation marks because it is interpreting it as a number.  Real numbers do not work, either.  Is there a workaround?

<cffunction name="jqgridCP" access="remote" returnformat="json">

I'm trying to populate a cfgrid with data from a cfquery.  The fields that have numbers as data (not all do) but are varchar in the database return empty cells.

It appears to be adding .0 to the numbers.

Views

220

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 20, 2015 0
Participant ,
Apr 20, 2015

Copy link to clipboard

Copied

Serialization of numeric values

Note: To use this feature, you must install ColdFusion 9 Update 1.

In the previous releases (including ColdFusion 9), serializing an integer using serializeJSON, converts the number to a double. For example, SerializeJSON (123) returns 123.0.

In ColdFusion 9.0.1, the integer is retained in its original format but enclosed within quotes. That is, SerializeJSON (123) returns "123". This is applicable only to positive integers.

The following table gives more examples:

Input

Serialized JSON

10

“10”

012

“012”

10.25

“10.25”

10.25E5

“1025000.0”

10.25E-5

“1.025E-4”

-10

“-10.0”

-10.25

“-10.25”

Note: To remove the quotes in the returned value, for positive integers and integers within quotes, set the jvm argument json.numberasdouble totrue . However, negative integers such as -10 will still be serialized to “-10.0” even if json.numberasdouble=true.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 20, 2015 0