I am reading data from a data base: I have the values I want
for (var index in entities) {
console.log(entities[index].PartitionKey);
console.log(entities[index].RowKey);
console.log(entities[index].Details);
console.log(entities[index].Date);
}
The above will print all the data I want. Now I want to convert this as an Json Object. How can I do that .
I have used and aware that I can use JSON.stringify but when I am trying this here in this context it is giving Error.
I tried keeping in the forloop:
jasonarray[index1].PartitionKey = entities[index].PartitionKey;
jasonarray[index1].RowKey = entities[index].RowKey;
and
JSON.stringify({ key: jasonarray[index1].PartitionKey, RowKey: jasonarray[index1].RowKey )
But it is giving as undefined when it comes to executing this function.
All I am looking is var x:
where x is a
[
{partionkey: "val",key: "val"}
{partionkey: "val",key1: "val"}
{partionkey: "val",key2: "val"}
]
entitieslook like in its original state? If it is an array, you should not be usingfor in, whose purpose is iterating object properties.console.log(JSON.stringify(entities))so we can see the structure of the originalentitiesarray.