Help Decoding JSON

Hello,

I am trying to decode the next JSON, i searched everywhere but i didn´t find anything…

I can get any other property from the JSON except inside “structured_formatting”. The purpose is to obtain the property “main_text” but the answer always says “undefined”:

I apreciate any help.

Thanks.

1 Like

Hi there, @jonathanvalgarlh4ow! :wave:

Welcome to the community! :wink: :tada:


I also deal with JSONs a lot :smile:

I took your JSON, compared it with your given blocks, I found that your blocks were absolutely correct :+1: :+1:


The problem is, The “else” blocks are not working…

Inside my apps in Thunkable X, I deal with IFs & ELSE a lot too…
I have experienced this problem a lot this week :pensive:


So, to make it work, you need to copy your “if” blocks, and add a “not” before them (so it will reverse (negative-ize :laughing:) the if blocks, same as it does in else area)

Have a look -

(I have highlighted the not block in red & white :slight_smile:)


(Please open the image in new tab, for better clarity :wink: )

Quick Summary

The not block negatives that equal block, so it is as good as else area :wink: .


Hope it helps you! :blush:

Thanks a lot! :smile:

Happy Thunking! :tada: :wink:

Thanks for the fast answer Kartik14,

I tried using else if + not. But the problem is still there.

I also placed it outside of the if condition and the same issue: “undefined”. It seems that it is not able to identify it (inside of “structured_formatting”) as an object to extract the properties…

Furthermore, if i place it like in the following image i get the following string text:

{“main_text” : “Hotel Malcom and Barret”,
“main_text_matched_substrings” : [
{
“length” : 6,
“offset” : 6
}
],
“secondary_text” : “Avenida Ausiás March, Valencia, España”}

I don´t understand why then i cannot extract the property “main text”…

Regards.

One tip that help me alot , use a json path finder i use this jsonpathfinder.com for example

there is a bug right now by using two blocks togheter of “Get property of object”

you have to chek if you are doing it right or is the bug ! check in the community and look for the post I did about this bug is called “using two blocks of get property returns undefined”
and there is also the temporaly solution

Thank you for the answers.

As Daniel said, it is a bug, so i fixed like this:

image

Regards.

3 Likes