tracker issue : CF-3184291

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

ColdFusion 8 / 9 / 10 does not accept correctly formatted json via Ajax

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Andrew Scott / Andrew Scott (Andrew Scott)

Created: 05/07/2012

Components: AJAX, Plumbing

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Public Beta / CF10_Update14

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Windows 7

Vote Count: 0

Problem Description:

For example a typical json object might be

myData = [10,0,1,5];

Yet when we send this across to ColdFusion, it fails miserably. This means that writing a ColdFusion webService, people who use other languages to connect to this ColdFusion webservice have to do extra work.

Railo seems to be a typical example of where it works right, as if you where to send the above myData string across in Railo the array would be created correctly. However ColdFusion requires that the data be quoted like such.

myData = ["10","0","1","5"];

If you read the specifications of Json at http://www.json.org/ it is obvious that ColdFusion is not dealing with passed JSon objects when calling remote CFC's

This seems to be causing issues with a lot of people trying to connect to a ColdFusion webservice from PHP, .Net, Java and many others that I have seen.

Steps to Reproduce:

http://blog.kukiel.net/2012/05/sending-arrays-from-javascript-to.html


Actual Result:

Expected Result:

Any Workarounds:

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

Watson Bug ID:	3184291

External Customer Info:
External Company:  
External Customer Name: ascott67
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Also see #CF-3184256 (Comment added from ex-user id:vnigam)
Comment by Adobe D.
19511 | May 08, 2012 12:50:25 AM GMT
The crux of the problem is that when passing a Array from Javascript to CF , CF sees it as Array[], with a comma separated string as its members Calling the method then gives “variable undefined” exception as CF can’t find a array. (Comment added from ex-user id:vnigam)
Comment by Adobe D.
19512 | May 08, 2012 01:04:36 AM GMT
But its a bug right? I mean Railo can handle it.
Comment by External U.
19513 | July 08, 2012 04:18:23 PM GMT
Can we get some clarification on the status of this, pls? State Open Status ToTest Reason NotABug That lot seems to all contradict one another! Cheers. -- Adam
Comment by External U.
19514 | September 24, 2013 09:33:35 AM GMT
It was marked incorrectly. I have corrected it.
Comment by Rupesh K.
19515 | September 24, 2013 09:55:52 AM GMT
Now CF honours the Ajax type in cfc function given that the Json object is stringified before making Ajax request.
Comment by Awdhesh K.
19516 | February 26, 2014 05:32:25 AM GMT