You can use the WRITE-JSON command from a prodataset or TT, or manually build JSON from within your code - likely for jquery e.g.
{&out}
'~{ "data": ['
.
for each cust no-lock break by cust.acc:
{&out}
'~{"name:":"' cust.name '"}'
.
if not last(cust.acc) then {&out} ','...