Request for JSON decode to dictionary

I want to use this block (from AI2) in Kodular. Although the method of Peter (the above link) worked sometimes, but when it faced array, it is completely wrong.

Check this topic for more information:

Hi @WatermelonIce…Until kodular adds this block to the web component, I created this extension that parses json to dictionary like the block in app inventor…
Please test if it works …
(of course this extension is only for those who wants to use the json text decode with dictionaries block while it doesn’t exist in kodular…And not a new something so i posted here and not in a new thread) :
That’s an example:
image
With app inventor:



Download link :
io.mohamed.JsonToDictionary.aix (6.4 KB)
I tested it with you json code here provided by @WatermelonIce

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

Hope it helps you…
EDIT:Reduced the aix size from 99.7 kb to 6.4 kb :exclamation:
That happened by removing unused third party library…

5 Likes

Wow, let me tried it out :slight_smile: :smiley:

1 Like

Hope it works :+1: :sweat_smile:

1 Like

It worked perfectly, and you can publish this extension. Just out of curiosity, will you provide the code too?

1 Like

Great :grin:

I don’t know should i publish this extension or no…As it’s already present in app inventor and of course it will be added in kodular…But of course i can provide the extension java code…

2 Likes

how can read text from direct .json file from, not from json text ?please help !

You must retrieve text from this json file ( i don’t where it is ) and then use the parseJsonWithDictionaries to parse it

You can use the File component to read .json yext and use the extension

1 Like