I am taking some information from a database on a recordet, conventing it to JSON notation.
But now, I do not know how to read only the names of my columns.
See this example:
http://www.jsoneditoronline.org/?id=1bccb6d9522392f4763d58e24ff4a8e6
I need to read the GND_AREA, DCR_AREA names.
EDIT:
Some folks give some answers below that works, but I think that I did not explain correctly what I want.
My object has a key named "List", and since that JSON has this construction:
I want to retrieve the string names. Not the values....
Exemple: I want those strings below because those strings are my columns names, and they can change depending on with table I search for my data.
GND_AREA, DCR_AREA, DCR_EQUIP and etc.....
P.S: Really new to javascript here
END EDIT
I tried all possibilities I found here, but I do not know if my JSON notation is right....
I trying to do this with java script.
last one I tried was this one:
Object.keys(obj).forEach(function (key) {
console.log (obj[key].name)
});
Here my string:
{
"List": [
{
"GND_AREA": "Redução",
"DCR_AREA": "Alto Forno 1",
"DCR_EQUIP": "AF1-Conjunto de Sopro 01 a 28",
"DCR_TECNCA": "Monitoramento",
"DCR_DCPLNA": "Temperatura",
"COD_POSIC": "61019",
"DCR_POSIC": "OB-F1-RE-ANVE-CJSO-01A05",
"DCR_POSFUN": "Conjunto de Sopro 01-05 do Anel de Vento do Alto Forno 1",
"DCR_PNTINS": "Algaraviz 1",
"DAT_INSP": "23/2/2016 21:28:48",
"VLR_DP_DESVIO": "",
"VLR_LTURA": "450",
"VLR_DMA_DESVIO": "350",
"COD_UNDMED": "°C "
},
{
"GND_AREA": "Redução",
"DCR_AREA": "Alto Forno 1",
"DCR_EQUIP": "AF1-Conjunto de Sopro 01 a 28",
"DCR_TECNCA": "Monitoramento",
"DCR_DCPLNA": "Temperatura",
"COD_POSIC": "61019",
"DCR_POSIC": "OB-F1-RE-ANVE-CJSO-01A05",
"DCR_POSFUN": "Conjunto de Sopro 01-05 do Anel de Vento do Alto Forno 1",
"DCR_PNTINS": "Algaraviz 1",
"DAT_INSP": "24/2/2016 21:37:49",
"VLR_DP_DESVIO": "",
"VLR_LTURA": "140",
"VLR_DMA_DESVIO": "350",
"COD_UNDMED": "°C "
}
]
}