So I am trying to repurpose an old Coldfusion page for an internal DBA tool to track long running queries.
The page currently does a query as a <CFQUERY name="GetLongRunners">
and then displays the data in a table format:
<table>
<tr>
<td>#GetLongRunners.spid#</td>
<td>#GetLongRunners.Database#</td>
</tr>
</table>
etc, etc
My goal is to strip out all of the display stuff, and be able to simply post to this page, and then receive JSON back with this same data. I played around with:
jsonData = SerializeJSON(#GetLongRunners#)
along with trying to be more specific with #GetLongRunners.database# and it does not seem to be working. The page shows 'jsonData = SerializeJSON(' and I get an error:
Complex object types cannot be converted to simple values.
I'm very new to ColdFusion, and am trying to encapsulate this functionality as much as I can, so I really only have to worry about posting to this page, and then I can get the raw JSON to work with in the front end.
All examples I found, built the queries in a very different way, and it seems to be outside my scope to do it this way.
I am picturing a simple way to serialize the query output as json and send it back as a JSON object. Either that, or build an array by looping through the results of the query, and then serializing that.
Any ideas?
Thanks!