Kodular has removed Json component?

I can’t find the Json component.
Has it been removed in this new version?

3 Likes

@micaot You now can use the built-in dictionaries blocks. Couple of references provided below:

https://docs.kodular.io/blocks/dictionaries/

http://ai2.appinventor.mit.edu/reference/blocks/dictionaries.html

5 Likes

And the applications that we already have, can we update them or will we have to modify them all?

New apps, won’t see that component.
Existing apps, can see the component. However, it would be better to use / switch to dictionaries block

4 Likes

I personally think that it is a mistake to remove a component as used as JSON.

We call data from remote databases or APIs through this component, and by searching for a complete info node within all the information.

Now this is no longer possible with kodular. I don’t know the reason, although I understand that there must be a very important reason.

2 Likes

Totally agree. In the meantime you can use the JSON extension.

Another one affected by the disapearence of the JSON component… As micaot has posted, it was a really needed component for remote databases APIS communications, and I was using it to retrieve data from jsons including arrays of jsons… Switching to dictionaries is a big drawback for me…

Why is that?

Weel, simple enough.
I haver already developed an app using the JSON component to comunicate with my server, as JSON is a widely used data exchange format. I have in mind developing a couple apps more that communicate with the same server, using he block I already have. So now I must redisgn the communication blocks (or maybe I could reload the project with a different name and delete all except for the JSON component in the screen… but I do not think using a deprecated component in a new project is a good idea).

I have not looked at how to perform the JSON parsing with dictionaries, but I guess I must convert the JSON text to a list of lists (in case of arrays would be to a list of lists of lists…) and then convert that to a dictionary. Which could be done directly and more intuitively with the JSON component.

In your case you can export the aia with a different name and as you import it you have the ability of the json blocks. Like @Hossein said. If you used them they are available. Only for new projects they are not there anymore.

Did you read the documentation links Hossein gave you?

As I said, I am not confortable in using a deprecated component in a new project, it may lead to problems.

I have read the documentation provided by Hossein, and I understand dictionaries is a very good utility, but the case is that I am receiving and sending JSONs through web services, so now I must parse the JSONs (in most cases they are JSON arrays of JSON objects) into the dictionaries, and the opposite, while until now I could directly work on the JSON and had the tools to easily do so. If the dictionaries had a method to convert from an to JSONs ( and what about arrays of json objects in that case, they would need to convert to arrays of dictionaries) it could be an options, but I see it, even though a dictionary can represent the same as a JSON, you still need to convert from one to the other, for wich there is no direct method.

Then what about this?
[one,two,three]
They don’t have keys

That is called as JSONArray. You can use List blocks to select an item from list after parsing your JSON with Dictionary blocks.

2 Likes

But how do you parse the JSON with dictionary blocks? I have not seen any method that performs that

Look at this sample on the App Inventor site.

http://ai2.appinventor.mit.edu/reference/other/json-web-apis.html

I see that examples uses the method “JsonTextDecodeWithDictionaries” from the Web component, that is not available in Kodular, so now again, we must manually parse the JSON into a dictionary, or a list of dictionary or a dictionary of lists of dictionaries or whatever corresponds, whereas with the JSON component we could directly use the JSON.

The block that is missing will be added. In the meantime you can use

I did a quick test with these blocks.

Which gave the following result

image

2 Likes

OK, thanks, it is good to know that method will be added .
Workarounds right now are a bit more complex, as I am receiving arrays of objects, so I would need more blocks to effectively parse the JSON into a list of dictionaries or even list of dictionaries with dictionaries as values