tracker issue : CF-3337487

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] ER for: serializeJSON(query) honor column type

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 09/26/2012

Components: AJAX, Plumbing

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final / CF10_Update14

Priority/Frequency: Trivial / Unknown

Locale/System: English / Win All

Vote Count: 2

This ER is for serializeJSON() to honor query's column type

Example:

writeOutput(serializeJSON(queryNew("lastName", "varchar", [["No"]])));

Actual Result: {"COLUMNS":["LASTNAME"],"DATA":[[false]]}

Expected Result: {"COLUMNS":["LASTNAME"],"DATA":[["No"]]}

Issue: The varchar string "No" should not be converted to boolean.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3337487

External Customer Info:
External Company:  
External Customer Name: itisdesign
External Customer Email:

Attachments:

Comments:

This was fixed in CF9 then reintroduced in CF10. EDIT: It looks like part of it was fixed in CF9, but some things were still broken.
Vote by External U.
17881 | October 24, 2012 04:40:52 PM GMT
Easier test (cfscript): //Broken - doesn't quote the value derp = "0000"; return SerializeJson(derp); // Working - returns "0000a" derp = "0000a"; return SerializeJson(derp); // Still Broken! Doesn't quote the value! derp = JavaCast('string', '0000'); return SerializeJson(derp); 0000 is not a valid JSON integer in most browsers, so it can't parse the result.
Comment by External U.
17873 | October 24, 2012 04:45:20 PM GMT
An extremely simple test for this bug: SerializeJSON( JavaCast("string", "yes") ); Returns an unquoted "true".
Comment by External U.
17874 | October 24, 2012 05:43:08 PM GMT
Well it's been one month since this bug was filed and there's still no response from Adobe.
Comment by External U.
17875 | October 26, 2012 12:06:39 PM GMT
It's not hard to verify this bug. Why is it taking so long to get a response?
Comment by External U.
17876 | October 29, 2012 05:55:59 PM GMT
Hello? ..... heloooooo? .... *taps microphone* Is this thing on? .... Is there anybody out there? ... Helllooooooooo?
Comment by External U.
17877 | November 02, 2012 03:21:23 PM GMT
Taking bets on whether or not Adobe will fix this.
Comment by External U.
17878 | November 07, 2012 07:32:14 PM GMT
It is a problem caused by the typelessness of CFML. Since CFML is not typed, it tries to judge the datatype based on the data. For example, a string "yes" is treated as a boolean in CFML and during JSON serialization this boolean will be serilaized as true. Since CFML does not have any data type, we don't know when you want the string "Yes" to be treated as String and when as a boolean. It is a difficult problem and we have not been able to find a good solution for it.
Comment by Rupesh K.
17879 | November 08, 2012 12:51:00 AM GMT
This is a serious issue, my workaround is nearly twice as slow as SerializeJSON(). Unacceptable, cannot use in production environment. Might have to revert back to CF8.
Vote by External U.
17882 | December 17, 2012 09:41:29 AM GMT
Temporary Fix for the issue is to serialize, then deserialize, then serialize it again. I can confirm this works. serializeJSON(deserializeJSON(serializeJSON(myQuery,true)))
Comment by External U.
17880 | December 17, 2012 12:53:28 PM GMT