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:

1 Like

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 :
You can refer to the topic below.
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…
Edit: rewritten the extension and released it in a new topic:

9 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

2 Likes

Use Json Decode block from Web component.
It will convert text to lists.
Use list to dictionary block from dictionary blocks.

1 Like

This method may not return the right result:

3 Likes