How can I read data from a JSON without knowing all the possible values?

(sometimes using the samsung keyboard translator)

Hi, I was searching the Internet for tutorials on how to read JSON data without knowing all the possible values but I haven't found it.

Basically what I'm trying to do is using an extension called "Notification Listener" by taifun to show the most recent notification in the app, but this extension returns me a result in a JSON like this:


I need to be able to put just the title and the message separately, but I can't find a way.

Thanks in advance


Hello Juan José,

you can try something like this:




Fortunately that works fine for me, I just encounter a small problem when trying to replace the text string with the variable that contains the JSON in the extension, I get an error:
Bad arguments to Text
The operation Text cannot accept the arguments:,[nothing]

Can you share your relevant blocks?

Here I use the extension variable instead of a text string

And the variable "json" is not empty?

No, when displaying it in a label it says the message in this format:{"packageName":"com.discord","title":"Wing","text":"ljhn"}

Try it without the block "DecodificarTextoJson"

That way it shows me "not found" on both labels

You can try the brute force:

I found an example like yours...but for a list of notifications so that they obtain a list of titles, a list of texts and a list of packages...maybe it will be useful to you:

DecodificarTextToJson does nor create a dictionary , the correct method would be JsonTextDecodeWithDictionaries, see also Connectivity

However the event Notification Received will be triggered only if your app is up and running... is this what you want to do?

See also trhe documentation of the extension here App Inventor Extensions: Notification Listener | Pura Vida Apps as well as the Q&A there


I just tried to do what was in that example but my result is the same that your other brute force example. Maybe it's better to try to make the error not appear, because the text I need is displayed fine but the error still appears.

If you are trying something, then it would really help very much to show us your relevant blocks


Uploading: testprintnotif.aia…
Uploading: shred (1).aia…
These are some attempts I made

Well, uploading your screenshots somehow did not work...


pruebanotificacion (1).aia (131.8 KB)
I couldn't upload them. Anyway, this is my current program.

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.