Hi I am trying to create a JSON response it needs to be like the one below. I
have created a CFC that returns a validate JSON response but not in the format
needed I think I am not understanding something can anyone help? Thanks
Response needs to look like this....
{"hotspots": [
{"distance": 100, "attribution": "This is a test layer POI provider",
"title": "My layer - snowy4",
"lon": 4884339,
"imageURL": null,
"line4": "RADIOLIST-None,CustSlider-None",
"line3": "SEARCHBOX - asdfdgxdg",
"line2": "DevlId - 896Settings: range=1000",
"actions": [],
"lat": 52374544,
"type": 0,
"id": "test_1"},
{"distance": 100, "attribution": "This is a test layer POI provider",
"title": "My layer - snowy4",
"lon": 4887339,
"imageURL": null,
"line4": "RADIOLIST-None,CustSlider-None",
"line3": "SEARCHBOX - asdfdgxdg",
"line2": "DevlId - 896Settings: range=1000",
"actions": [],
"lat": 52374544,
"type": 0,
"id": "test_2"}
],
"layer": "snowy4",
"errorString": "ok",
"morePages": false,
"errorCode": 0,
"nextPageKey": null
}
My CFC
<cfscript>
var response = {}
response.hotspots = {
distance ='100',
attribution="This is a test layer POI provider",
title= "My layer - snowy4",
lon= "53.472696",
imageURL='null',
line4= 'RADIOLIST-None,CustSlider-None',
line3= 'SEARCHBOX - asdfdgxdg',
line2= 'DevlId - 896Settings: range=1000',
actions='',
lat= '-2.261843',
type='0',
id='test_1'
};
response.layer = "testme";
response.errorString='ok';
response.morePages='false';
response.errorCode= '0';
response.nextPageKey='null';
</cfscript>
which gives me the JSON...
{
"HOTSPOTS": {
"TYPE": 0.0,
"ATTRIBUTION": "This is a test layer POI provider",
"LINE2": "DevlId - 896Settings: range=1000",
"TITLE": "My layer - snowy4",
"LINE4": "RADIOLIST-None,CustSlider-None",
"LAT": 5.2374544E7,
"ACTIONS": "",
"IMAGEURL": "null",
"LINE3": "SEARCHBOX - asdfdgxdg",
"LON": 4884339.0,
"ID": "test_1",
"DISTANCE": 100.0
},
"ERRORSTRING": "ok",
"NEXTPAGEKEY": "null",
"LAYER": "testme",
"MOREPAGES": false,
"ERRORCODE": 0.0
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334957
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm