Json decoded list

Hi, I have a hard time to figure aut how to output a default text if decoded list is shorter and don't have an entry.

can anyone help me with a solution?
Thank you

What are you expecting in your result (JSONDecoded) ?

Fill in missing data at Lookup time, using the notfound input to the lookup in pairs block and the corresponding dictionary lookup block.

Also, use the Web.DecodeJSONAsDictionaries block for full functionality.

I need to extract data like aaaaa from a webpage that change all the time and put it in a label. The format is the one in the result but the list can be with 4 and 2 data text.

Can you have any ideea where to start? Thank you both!

Do you want all of the values or just one ?

I note that you original json is poorly formed, there are no commas separating the inner values...

Once your json is correctly formed:

image

Wow Thank you very much! I will try your blocks. Can I extract only aaaaa ?

You could do it like this:

thank you very very much! :slight_smile: :grin:

I'll try now!

unfortunately, it dosent work any of examples, but thank you for your fast answer. If anyone can figure a solution please help me.

I need to extract from an online database a text from this format:

{"aaaaa":{"aaa":"1","bbb":"xx34","ccc":"s3","ddd":"34"},
"bbbbbb":{"jjj":"45","lll":"24","pin":"333","444":"hhh"},
"ccccc":{"111":"44","22":"25"}}

but in "ccc" i have only 111 and 222 and with my code i got error, because the "ccc" must have 4 "texts"

Thank you!

Working OK here:

image

Perhaps check the format of your incoming data ?

Any errors showing ?

the error is cannot accept arguments ,[aaa.... I dont know why is this because I use local list.
Ca you give me the rawlist in your example? I checked ten times to be in correct format. Thank you very much. I keep trying...

It would really help if you provided a screenshot of your relevant blocks including the complete error message, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

As you can see from my app screenshot, I used the json string you provided in post #12.

Taifun thank you very much for trying to help, and also thank you TIMAI2, but unfortunately is too complicated to me.

In the first pic of the this post, I read an online database.

The first text (aaa) remain the same but the other four, will change. I read the other text after "aaa" by loop all four of them but sometime will be only two.
The json is correct, and if I use dictionaries it will be the same as in TIMAI2 example, but with that example i got error. Maybe I need to clear the cache of PC?

If the first text like aaa have other four texts is ok with my code, but if the text aaa have only two I get error. So I need to skip or put a blank key text for loop to clear the error. I think....

Like this (texts are representative, no calculations or comparation at all, I just want to extract them from online database):

loop: 1 to 4 by 1

for:


aaa:
  - a1=b1
  - a2=b2
  - a3=b3
  - a4=b4
bbb:
  - b1=b1
  - b2=b2
  - b3=b3
  - b4=b4

this work with my code but:

aaa:
  - a1=b1
  - a2=b2
  - a3=b3
  - a4=b4
bbb:
  - b1=b1
  - b2=b2    (only 2) wont work because of loop 1 to 4 by 1

of course I got list item error and here I need your wisdom. Amyway I will keep trying. I delete the blocks (1.000 of them), but if you will, I will reproduce them after a PC restart. Thanks!

Show the raw json coming in from your database

probably because the json is NOT correct ?

What is this ?

image