Guide: Dictionary Blocks

Very detailed guide :heart_eyes:
It is hard to make guide . Great job @WatermelonIce

2 Likes

I made it wiki so that everyone can correct me if I have said anything wrong :wink:

1 Like

I have 2 questions:

  1. By reading your guide, I understand that we can store string and number as value in dictionary, is there anything else we can store in dictionary?

  2. Does the dictionary stores values as like tiny db so that we can call it later or as like global variable ?

Answer to your both questions is Yes.

1 Like

Almost everything can be stored

1 Like

I also have a guide about this:

1 Like

Nice a detailed Guide :ok_hand: Good.

2 Likes

Great guide @WatermelonIce i think you are expert in json

2 Likes

I don’t think this is a thing :sweat_smile:

1 Like

Hello
I appreciate this complete and easy-to-understand commentary. I also wrote a specific explanation of how to use the Dictionary feature of MIT App Inventor. Especially for “list by walking key path” and “walk all at level”. I would be happy if the following blog posts were any useful:

3 Likes

Wow, thank you for the detailed explanation! I am sure people will learn from it :blush:

OMG so good very helpful especailly for me :sweat_smile:

Thank you so much

2 Likes

Are these like objects in Javascript?

Yes, I think.


JSON = JavaScript Object Notation

2 Likes

Great guide. Super helpful

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

I want to parse name 1 & name 2 value

Here we have two different JSON object. You have to separate them, or make them in a list.

2 Likes

How can i do that

Separate them so it looks like these two JSON texts:

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

and this

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

Then,

do this with both JSON, change the name1 to name2 when working with the second object.

1 Like

how can we use the if-else block to create a dictionary