I'm trying to count the length of the JSON array element. I know to count the length of array using json.array.length
. That is need to find that how many items in every index.
If my array is:
{
"shareInfo": [{
"id": "1",
"a": "sss",
"b": "sss",
"question": "whi?"
},
{
"id": "2",
"a": "sss",
"b": "sss",
"question": "whi?"
},
{
"id": "3",
"a": "sss",
"b": "sss",
"question": "whi?"
},
{
"id": "4",
"a": "sss",
"b": "sss",
"question": "whi?"
}
]
}
Then I need to find the length of {"id":"1","a":"sss","b":"sss","question":"whi?"}
. In this there have four items. I tried this with data.shareInfo[i].length
. But it produces error.
Please anyone tell me how to find the length.... Thanks....