JSON text decode problem

I have been using this method to convert json text to dictionary.


However, when it faced objects in array, the dictionary is completely wrong.

It seems that the list of pairs is correct but the dictionary isn’t.
My sample code:

{
	"names": [
		{
			"name": "Peter",
			"age": 30
		},
		{
			"name": "John",
			"age": 27
		},
		{
			"name": "Luke",
			"age": 34
		}
	]
}

Thanks in advance.

1 Like

Just tried that with this block in AI2, it worked perfectly:

2 Likes

That’s because the block in Kodular is meant for responses from APIs which turns the response into a list so that it’s easier to parse. The block from App Inventor is specifically meant for Dictionaries that are built-in to the builder.

1 Like