You see, this is my issue:
I need to get a .json file from a SQL query. In order to do that, I use the following ColdFusion .cfm file:
<cfsetting showdebugoutput="no">
<cfheader name="Content-Type" value="application/json">
<cfquery name="GetData" datasource="myDataSource">
select distinct ap1, ap2, nombre, idcargo
FROM vlayout_1
where cct='13DCC0003S'
</cfquery>
<cfoutput>
#SerializeJSON(GetData, true)#
</cfoutput>
Then, I save this file in my localhost server and this is the result:
{"ROWCOUNT":12,"COLUMNS":["AP1","AP2","NOMBRE","IDCARGO"],"DATA":{"AP1":["ALVARADO","BAUTISTA","HERNANDEZ","HERNANDEZ","HERNANDEZ","HERNANDEZ","HERNANDEZ","HERNANDEZ","HERNANDEZ","LORENZO","MARTINEZ","SIXTO"],"AP2":["HERNANDEZ","OSORIO","ALVARADO","ANDRADE","HERNANDEZ","HERNANDEZ","HERNANDEZ","MARTINEZ","QUINTERO","LEON","HERNANDEZ","RAMIREZ"],"NOMBRE":["ALEJANDRO","ANTONIO","LAURA","MA. TERESA","FILOMENA","MARIA GUADALUPE","MARIA LUISA","MARIA MANUELA","CIRILA","JUAN","ROSALBA","EUTIQUIO"],"IDCARGO":[3,3,3,2,3,3,3,3,3,3,1,3]}}
Once I validate it and format it to JSON through http://jsonlint.com/, this is what I obtain:
{
"ROWCOUNT": 12,
"COLUMNS": [
"AP1",
"AP2",
"NOMBRE",
"IDCARGO"
],
"DATA": {
"AP1": [
"ALVARADO",
"BAUTISTA",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"LORENZO",
"MARTINEZ",
"SIXTO"
],
"AP2": [
"HERNANDEZ",
"OSORIO",
"ALVARADO",
"ANDRADE",
"HERNANDEZ",
"HERNANDEZ",
"HERNANDEZ",
"MARTINEZ",
"QUINTERO",
"LEON",
"HERNANDEZ",
"RAMIREZ"
],
"NOMBRE": [
"ALEJANDRO",
"ANTONIO",
"LAURA",
"MA. TERESA",
"FILOMENA",
"MARIA GUADALUPE",
"MARIA LUISA",
"MARIA MANUELA",
"CIRILA",
"JUAN",
"ROSALBA",
"EUTIQUIO"
],
"IDCARGO": [
3,
3,
3,
2,
3,
3,
3,
3,
3,
3,
1,
3
]
}
}
The issue is that they asked me this .json format:
actasPrimeraAsamblea:{
[
ceIntegrante:[
{paterno:HERNANDEZ,
materno:MARTÍNEZ,
nombre:MARÍA GUADALUPE,
idcargo:3},
{paterno:PÉREZ,
materno:ROSALES,
nombre:JOSÉ,
idcargo:3},
{paterno:RAMÍREZ,
materno:GONZÁLEZ,
nombre:MARIO,
idcargo:3}
]
]
}
Can you note the differences? My original .json format shows me the View columns, and I need it to be combined.
How can I achieve this?
Thank you in advance, it has been really frustrating.
Sorry for my poor english.