I've built a functional REST service that is successfully returning a query result:
<cffunction name="getAllOrders" access="remote" returntype="any" httpmethod="GET" returnFormat="json">
<cfquery name="getAllOrders" datasource="test">
select * from concreteOrder
<cfset results = #serializeJSON(getAllOrders)#>
I've been trying different formats but I'm not understanding the docs (my apologies, the holidays has made my brain fuzzy).
Does anyone know the correct format I should use in the serializeJSON() method to successfully bring back name:value pairs from the query results in my JSON object? All I've been able to do is bring back each row as a blob and then my Angular app can't do anything with that.... Ideally I'd like to bring back each row with something like "id": "1", "col2":"value", "col3":"value".... and so on
ugh, I just got it sorted out....
The docs are pretty in depth and here's what you need to do:
my cffunction code is fine, leaving it exactly as is all I did was add this line to my Application.cfc and problem solved:
Saved, reloaded the REST service in the CF Admin and the new correct format works just fine.
I hope this helps someone else!