Hi,
Flex dev here - wannabe CF coder :-)

I need to return some JSON to a Flash Lite client, the format I'd like  
to produce looks like this:

{
        "total": "100",
        "items":
        [
                {"id": "0", "title": "Some Title"},
                {"id": "0", "title": "Some Title"},
                {"id": "0", "title": "Some Title"},
                {"id": "0", "title": "Some Title"},
                {"id": "0", "title": "Some Title"}
     ]
}

I have a query called 'list'.
The 100 above should be my query's recordcount. The items are simply  
records in the query. I can't quite figure out how to  
'manually' (maybe by looping over my query) produce the JSON output. I  
have see the JSON related functions and I can JSON-iny my query but  
then the format is not as above, but as CF choses.

Right now I am running this code:
<cfquery datasource="#APPLICATION.datasource#" name="list">
SELECT fileid, entered_name from slides ORDER BY added DESC LIMIT  
#URL.start#,#URL.length#
</cfquery>
                
<cfset jsondata = serializeJSON(list)>
<cfoutput>#jsondata#</cfoutput>

Which gives me the output here:
http://www.sharemyslides.com/api/lite.cfm?action=list


Any pointers appreciated.

Cheers

Stefan




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327065
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to