tracker issue : CF-3694322

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

String in Array Converted to Boolean

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/LowImpact

Reporter/Name(from Bugbase): Christopher Tierney / Christopher Tierney (Christopher Tierney)

Created: 01/15/2014

Components: Language, Serialization

Versions: 9.0.1

Failure Type: Data Corruption

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 2

Problem Description: When a method in a component serializes an array within a struct, using returnFormat="JSON", the resulting JSON output will take a string of "yes" and turn it into a boolean of true.

Steps to Reproduce:
Data:
-- Inside a method of a component with a returnFormat="JSON" --
-- myQueryResult is a column from a query result --

myStruct = { "cell" = [ myQueryResult['myVarChar'][1] ] }
return myStruct

Actual Result:
{"cell"=[true]}

Expected Result:
{"cell"=["yes"]}

Any Workarounds:
Add space to end of string being entered into the array and then trim it on the client side.

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

Watson Bug ID:	3694322

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: CFJSGeek
External Customer Email:

Attachments:

Comments:

This does cause issues at time with client side code.
Vote by External U.
13692 | January 15, 2014 04:12:55 PM GMT
This is a pretty annoying bug and can cause problems with evaluating the results properly.
Vote by External U.
13693 | January 15, 2014 04:46:39 PM GMT
Can you please attach a repro case with the bug?
Comment by Nimit S.
13688 | January 18, 2014 03:31:09 AM GMT
For Pete's sake, Nimit. He describes the repro case in the ticket. Did you read it??! To remove all doubt: here's one: https://gist.github.com/daccfml/8497974 Both CF9 and CF10 are impacted by this. It's more simple than CFJSGeek said... the string value "yes" in either a struct or array (or the cited array-within-struct) gets serialised as true. The string "yes" should not be converted to the boolean true in JSON. Is that clear? Once again... Railo gets this right. How can you guys - continually - make such a pig's ear of this? -- Adam
Comment by External U.
13689 | January 18, 2014 05:29:39 PM GMT
Actually... just added a new method. It doesn't even serialise a STRING properly. -- Adam
Comment by External U.
13690 | January 18, 2014 05:36:20 PM GMT
Want to verify you have all the examples you need in my description and Adam's repo.
Comment by External U.
13691 | January 26, 2014 10:31:14 PM GMT