How can I plot the stringified json data in charts?

I've intialized 'jsonArray' as a string. My bad!!

it's false. Not a list!!

your script is working fine with me too (i tried it as a separate project). But, I am working with other screens too. So, I thought i might give my script a shot.

Check the content of your responseContent, if that looks like a stringified json array, then see what happens when you use the decode block on it. If you are not getting back a stringified array, then you need to look at your script.

1 Like

image


Response Content & decoded jsonArray

A great thanks to you @TIMAI2 :cowboy_hat_face: :partying_face:

I just tried to decoded the json string again (like twice), then it was a LIST! and I plotted the data. :star_struck:

1 Like

I tried to plot again today. It's showing this error:

Data column for axis #0 cannot be type string

This is my block.

Why are you using jsontextdecode block twice ?

Haven't you already added the header row in the script ?

As I have already said before, the first decoded text looks like a json text, but it seems it's not.
The response content is in a string format, so is the firstly decode jsonString. Only the jsonArray (jsonString after being decoded again) is in the list format.

I was able to plot it yesterday, when I was only using the 7 data... Now that I've added 30 data, It says the above mentioned error.

Yes, I have.

Then do not add it again. This will put strings in the plot data when expecting numbers

If I'm not adding it again, it says the decoded json is a string and not a list.

Do I have to add the little procedure that you've added before?

I was talking about the header row you are adding in the blocks!

You should not have to jsontextdecode twice to get a list, if you are returning a stringified JSON array correctly, as shown by my example.

1 Like

yah, i realized that my json string was stringified twice in my script (I didn't notice), hence I have to decode it twice. Now it's fine with one block.

And I used the little procedure you have suggested before. And it PLOTS!!

Thank you so much @TIMAI2. Thank you for your patience & timely help. May God bless :sparkles:

1 Like