JSON array

Hi,
I have connector response in json array and trying to access the properties like
resp.body.address[0].country but unable to evaluate and giving “No property found with name ‘country’ of value ‘ValNull’. Available properties:”.

below are my json response

{
	"status": 200,
	"body": {
		"address": [
			{
				"country": "US",
				"countryCode": "us"
			}
		]
	}
}

TIA

In FEEL expressions the first element of an array is actually [1]
So you can change your expression to
resp.body.address[1].country

In future you can test your feel expressions here in the FEEL playground.

4 Likes

Thanks @Niall but Array index start from zero(0) right?

TIA.

Normally yes… but for some reason the good people the OMG (who designed the standard) decided to confuse everyone by making arrays in FEEL start with 1.
I get the FEELing (:wink:) that you wont be the last person to have this problem… it’s very annoying.

2 Likes

:sweat_smile: exactly confusing.

Well, FEEL stands for “Friendly Enough Expression Language”, and it’s friendly to all the users that are not programmers and start counting by 1 and use spaces to separate a single word from another.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.