Runtime Error: JSON array.length - A null object reference

Hi Koders,

Today while working with JSON data in my app which was working fine suddenly started giving me a runtime error. The image of the error is below.

I even cross checked the length of JSON array using a notifier, it’s giving correct value which is 56. Moreover, All the functions of app is properly working if I ignore this error.

Extension : JSONTools

Please help to sort out with this error.

Thanks!

It would really help if you provided a screenshot of your relevant blocks, 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

@Taifun I have just PM ’ ed You the Image of my Blocks.

please post the screenshot here in this thread
thank you
Taifun

Here’s The Blocks

[ I have tried other ways also, but can’t figure out the exact block causing this error ( Suspecting that the JSONTools1.OpenJSONArray is the root cause of error but without this app can’t run ) ]

EDIT: no one is interested to sort my problem :disappointed::disappointed:

Thanks!

I think the problem is here:

‘Do it’ and see what happens…

A developer (no matter which platform he/she uses) should be patient :disappointed:

I think you have not read this.

BTW, I have tried a lot things :
I even deleted / Disabled the whole for loop but even got the error therefore I suspect problem is with OpenJSONArray.

If so then there can be:
1.Problem in some other blocks
2.You have not parsed JSON correctly

Runtime Error says a lot about error in code either in java or blocks.And this runtime error shows that the problem is because a JSON array has 0 as length.So either JSON is empty or has empty array.

Again I think here your forgot to read this.
:point_down::point_down:

The json is used to create some card and display images and text from json. & it’s showing all those things correctly.

any suggestion from you taifun?

Did you post sample json what you are getting