i have a Json Object in Javascript, looking like this:
{
"properties": {
"processowner" : { "valueType": "text" },
"withwhat" : { "valueType": "text" },
"withwho" : { "valueType": "text" },
"processstep" : { "valueType": "text" },
"cluster" : { "valueType": "text" }
},
"items": [
{
"label": "anytitle",
"processowner": ["Name"],
"withwhat": ["ben\u00f6tigtes Material","ben\u00f6tigtes Material2","ben\u00f6tigtes Material3"],
"withwho": ["Verantwortliche Person"],
"processstep": ["1. Schritt 1","2. Schritt 2","3. Schritt 3","4. Schritt 4","5. Schritt 5"],
"cluster": ["anyname"]
},
{
"label": "anytitle",
"processowner": ["Name"],
"withwhat": ["ben\u00f6tigtes Material","ben\u00f6tigtes Material2","ben\u00f6tigtes Material3"],
"withwho": ["Verantwortliche Person"],
"processstep": ["1. Schritt 1","2. Schritt 2","3. Schritt 3","4. Schritt 4","5. Schritt 5"],
"cluster": ["anyname"]
},
........
}
What i want is only the "items" part. Looking like this:
[
{
"label": "anytitle",
"processowner": ["Name"],
"withwhat": ["ben\u00f6tigtes Material","ben\u00f6tigtes Material2","ben\u00f6tigtes Material3"],
"withwho": ["Verantwortliche Person"],
"processstep": ["1. Schritt 1","2. Schritt 2","3. Schritt 3","4. Schritt 4","5. Schritt 5"],
"cluster": ["anyname"]
},
{
"label": "anytitle",
"processowner": ["Name"],
"withwhat": ["ben\u00f6tigtes Material","ben\u00f6tigtes Material2","ben\u00f6tigtes Material3"],
"withwho": ["Verantwortliche Person"],
"processstep": ["1. Schritt 1","2. Schritt 2","3. Schritt 3","4. Schritt 4","5. Schritt 5"],
"cluster": ["anyname"]
},
........
]
I tried to access it with objectname.items But i always get "undefined" when printing out on console.
edit:
function getJSON() {
var req = https.get(options, function(response) {
// handle the response
var res_data = '';
response.on('data', function(chunk) {
res_data += chunk;
});
response.on('end', function() {
var wikiJSON = res_data;
console.log(wikiJSON.items);
});
});
req.on('error', function(e) {
console.log("Got error: " + e.message);
});
req.end();
}