<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">

<cfquery name="q" datasource="payfrit">
  SELECT ID, Name, BeaconShardID, BeaconMajor
  FROM Businesses
  WHERE IsDemo = 0 AND IsPrivate = 0
  ORDER BY Name
</cfquery>

<cfset bizList = []>
<cfloop query="q">
  <cfset arrayAppend(bizList, {
    "ID": q.ID,
    "Name": q.Name,
    "BeaconShardID": val(q.BeaconShardID),
    "BeaconMajor": val(q.BeaconMajor)
  })>
</cfloop>

<cfoutput>#serializeJSON({ "OK": true, "Count": q.recordCount, "Businesses": bizList })#</cfoutput>
