any way we can find out the number of array inside array in api
ex:
{
“Store”: [
{
“Id”: “101”,
“fruit”: “251”,
“fruitid”: “O-0238”,
“fruitSubId”: “A-S001”,
“fruitAccId”: “A004”,
“enduser”: [
{
“endId”: “193”,
“UserFirstName”: “NA”,
“UserLastName”: “NA”,
“endName”: “TEST”,
“Street”: “”,
“City”: “”,
“State”: “”,
“Country”: “US”,
“PostalCode”: “”,
“Pro”: [
{
“sku”: “Apple”,
“qty”: “sell”,
“quantity”: “13”,
“startDate”: “2022-11-01 00:00:00”,
“endDate”: “2022-11-30 23:59:59”
}
]
}
this end user may have multiple array within that anyway we can get the count of it
Anil_G
(Anil Gorthi)
December 17, 2022, 6:14am
2
@manoj_verma1
Try jsonparse and then you should be able to count the number of array items in it
Cheers
@manoj_verma1
If you need to count, you can try with regex Matches.
system.Text.RegularExpressions.Regex.Matches(YourString,"\Wenduser\W").Count.tostring
Where
Yourstring is text from API
Yoichi
(Yoichi)
December 17, 2022, 7:39am
4
Hi,
Can you try the following sample?
Jo("Store")(0)("enduser").Count
OR
ja = CType(Jo("Store")(0)("enduser"),JArray)
Then
ja.Count
Sample20221215-6v4.zip (3.4 KB)
Regards,
2 Likes
system
(system)
Closed
December 20, 2022, 7:39am
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.