Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I show the column names in my JSON file format? (Through ColdFusion)
    primarykey
    data
    text
    <p>Through the following ColdFusion .cfm file, I am able to get a .json string, which shows me the requested data:</p> <p><strong>json1.cfm</strong></p> <pre><code>&lt;cfsetting showdebugoutput="no"&gt; &lt;cfheader name="Content-Type" value="application/json"&gt; &lt;cfquery name="GetData" datasource="myDataSource"&gt; select distinct ap1, ap2, nombre, idcargo, idencal, telefono, email, cve_nivel, sexo FROM vlayout_1 where cct='13DCC0003S' &lt;/cfquery&gt; &lt;cfoutput&gt; #SerializeJSON(GetData, false)# &lt;/cfoutput&gt; </code></pre> <p>Once I upload it on my local server, this is the outcome .json string:</p> <pre><code>{"COLUMNS":["AP1","AP2","NOMBRE","IDCARGO","IDENCAL","TELEFONO","EMAIL","CVE_NIVEL","SEXO"],"DATA":[["ALVARADO","HERNANDEZ","ALEJANDRO",3,1,"","",5,"M"],["BAUTISTA","OSORIO","ANTONIO",3,5,"","",6,"M"],["HERNANDEZ","ALVARADO","LAURA",3,5,"","",6,"F"],["HERNANDEZ","ANDRADE","MA. TERESA",2,5,"","",6,"F"],["HERNANDEZ","HERNANDEZ","FILOMENA",3,5,"","",4,""],["HERNANDEZ","HERNANDEZ","FILOMENA",3,5,"","",5,""],["HERNANDEZ","HERNANDEZ","MARIA GUADALUPE",3,5,"","",5,"F"],["HERNANDEZ","HERNANDEZ","MARIA LUISA",3,5,"","",4,"F"],["HERNANDEZ","MARTINEZ","MARIA MANUELA",3,5,"","",4,"F"],["HERNANDEZ","QUINTERO","CIRILA",3,5,"","",5,"F"],["LORENZO","LEON","JUAN",3,5,"","",6,"M"],["MARTINEZ","HERNANDEZ","ROSALBA",1,5,"","",5,"F"],["SIXTO","RAMIREZ","EUTIQUIO",3,5,"","",4,"M"],["SIXTO","RAMIREZ","EUTIQUIO",3,5,"","",5,"M"]]} </code></pre> <p>After I validate on <a href="http://jsonlint.com/" rel="nofollow">http://jsonlint.com/</a> this is what I get:</p> <pre><code>{ "COLUMNS": [ "AP1", "AP2", "NOMBRE", "IDCARGO", "IDENCAL", "TELEFONO", "EMAIL", "CVE_NIVEL", "SEXO" ], "DATA": [ [ "ALVARADO", "HERNANDEZ", "ALEJANDRO", 3, 1, "", "", 5, "M" ], [ "BAUTISTA", "OSORIO", "ANTONIO", 3, 5, "", "", 6, "M" ], [ "HERNANDEZ", "ALVARADO", "LAURA", 3, 5, "", "", 6, "F" ], [ "HERNANDEZ", "ANDRADE", "MA. TERESA", 2, 5, "", "", 6, "F" ], [ "HERNANDEZ", "HERNANDEZ", "FILOMENA", 3, 5, "", "", 4, "" ], [ "HERNANDEZ", "HERNANDEZ", "FILOMENA", 3, 5, "", "", 5, "" ], [ "HERNANDEZ", "HERNANDEZ", "MARIA GUADALUPE", 3, 5, "", "", 5, "F" ], [ "HERNANDEZ", "HERNANDEZ", "MARIA LUISA", 3, 5, "", "", 4, "F" ], [ "HERNANDEZ", "MARTINEZ", "MARIA MANUELA", 3, 5, "", "", 4, "F" ], [ "HERNANDEZ", "QUINTERO", "CIRILA", 3, 5, "", "", 5, "F" ], [ "LORENZO", "LEON", "JUAN", 3, 5, "", "", 6, "M" ], [ "MARTINEZ", "HERNANDEZ", "ROSALBA", 1, 5, "", "", 5, "F" ], [ "SIXTO", "RAMIREZ", "EUTIQUIO", 3, 5, "", "", 4, "M" ], [ "SIXTO", "RAMIREZ", "EUTIQUIO", 3, 5, "", "", 5, "M" ] ] } </code></pre> <p>The question is, <strong>how can I show every column name before its content</strong>? e.g.:</p> <pre><code> [ AP1:"SIXTO", AP2:"RAMIREZ", NOMBRE:"EUTIQUIO", IDCARGO:3, IDENCAL:5, TELEFONO:"", EMAIL:"", CVE_NIVEL:5, SEXO:"M" ] </code></pre> <p>Thank you so much in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload