Get the property's array length in JSON response in Logic Apps

Solution 1:

I suspect you need to use the Parse JSON action with your string response.

Parse JSON

Once loaded in, you can then use the expressions I've used below to get your result. In relation to your example, I can see it's a length of one just by looking at it.

This is the expression you need ... length(body('Parse_JSON')?['value'])

Array

If the array is empty, it still produces the correct result of 0.

Empty Array

If I dummy up a few more items in the array (just by duplicating the one you have) then I get the right answer.

{
  "value": [
    {
      "Name": "StackOverflow",
      "Type": "Online",
      "count": 123,
      "location": [
        "USA",
        "CAN",
        "ENG",
        "AUS"
      ]
    },
    {
      "Name": "StackOverflow",
      "Type": "Online",
      "count": 123,
      "location": [
        "USA",
        "CAN",
        "ENG",
        "AUS"
      ]
    },
    {
      "Name": "StackOverflow",
      "Type": "Online",
      "count": 123,
      "location": [
        "USA",
        "CAN",
        "ENG",
        "AUS"
      ]
    }
  ]
}

Array