How to use the dictionary from the assets?

I recently created a json file I added it to the assets of the application and I wanted to read its data using the blocks of the dictionary but I did not find a way to do it
Is there any way to do that?

Read file using File component and then get the json value from GotText event.

Thanks for your reply, but it requires storage permission and it could be a bit problematic for users who have not approved it
Is there another way?

Yes, there is always at least one workaround.

1 Like

I did it but it does not work :slightly_frowning_face:
Did I do something wrong?

Whats happen ?
Give us more details. :thumbsup:

1 Like

How about putting it as text in a variable or string?

that could also be a way to achieve this.

I mean, you should open that json file, copy and paste it in your project as a variable or string or whatever that can return that text, then you can easily use it as dictionary :wink:

Iโ€™m not getting any response

I think it works same as File component so to read file from assets you should use //.
Also you should always use absolute file path.

2 Likes

exactlyโ€ฆ
this should work as file name: //file.json

Taifun

3 Likes

Yes, and there is no need to use the EFile ext. in this case.

No, see this post in the Power User forum (AI2) from the MIT team:

2 Likes

Thanks for the suggestions but unfortunately I still do not get any response :frowning_face:
Iโ€™ll be happy if you can check out the projecttest.aia (20.3 KB)

Try this, I used file component and works fine

testa_1.aia (20.1 KB)

1 Like

thank you for the answer!
So it turns out I should have just written it like this:
blocks (3)
Sorry for my lack of understanding :sweat_smile:
Thanks to all the helpers!

1 Like

Usually you can use File component but you should start looking for alternatives if you are concerned about unwanted permissions.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.