I am working with a Json document that looks like this:
{
"_id": "13fee4aad95c7f822c0b559bd8d09fb0",
"_rev": "5-336dea3680af3e7ec0de29369be90b09",
"attributeCollection": {
"attributeArray": [
{
"name": "Web Issue",
"value": [
"web security authentication"
]
}
]
},
"hash": "1047fe2e1e58e5c8246b26f015d0ecd7"
}
Using JavaScript, I have successfully extracted the "value" with this code:
if (doc.attributeCollection.attributeArray[i].value) {
for (var j=0; j<doc.attributeCollection.attributeArray[i].value.length; j++) {
value = doc.attributeCollection.attributeArray[i].value[j];
}
}
However, my challenge lies in converting the "value" to a string. Since "value" only contains one element, I have tried different methods such as:
var content=value.toString();
or
var content=value.join("");
Even when using a loop like this:
var content="";
for(var i; i<value.length; i++){
content=content+value[i];
}
The conversion still doesn't work. What could be causing these issues?