Do any of you know how to display the results using the “get JSON from object” or something? Because it isn’t working, and my label isn’t showing the results, it’s showing null. Can any of you please help??? thank you
It is better to make a new post and ask this question and provide screen shot of your coding block so that other can see what’s wrong with your code.
You should be able to print JSON directly onto a label.
How are you creating this object in your project?
Hello! I’m trying to create an OCR project, using OCR space: Free OCR API . This api is known to work with thunkable, if you search up ocr in thunkable community, you will see others talking about it! I’m trying to make the label display the text that this ocr detects. May I ask you to create an ocr api and see what properties my json should gather? My code looks like this right now:
Also, the result IS coming, but it’s in JSON format. I need it to be JUST the words that the ocr detects, not the entire json, so this is what I tried. But it shows ‘null’. I know it’s a lot to ask, and I honestly need a solution today😅… Do you think you could help @jane ? Thank you so much!
Hello! I suppose that’s better, but since I already found a topic discussing the same, I just posted it here. Thanks for the advice anyway!
Are you getting the right text, just in the Json format?
I need the text to be concentrated on the text detected, not the entire response
If you are debugging an issue with getting properties from a JSON response, I would recommend printing your entire JSON response on a Label first. If you have an error with this, you need to revise your Web API call. If you can successfully print the entire JSON response, then you need to make sure you are getting the correct properties of your response.
You can see an example of this narrowing down of a response here: Reverse Geocoding App - Get Location from Latitude/Longitude
Thank you! I’ve actually tried printing the entire JSON response, and it worked! Unfortunately, I’ve already seen this community link, and inputted the correct properties. I’m afraid this is a thunkable error! Is there anything you may know about this? Once again, thank you so much for your responses, all of you! It helps!
Because most APIs return JSON, you need to get the object from JSON (from the green “response” block) rather than trying to generate JSON from the object (it’s not an object).
Also, the “ParsedResults” or “ParsedText” value may be empty (null). In fact, the sample URL in their documentation just returned a null ParsedResults value for me (“Timed out waiting for results”).
You’re going to have to consider what types of responses you might get – including error messages from the API – and plan your blocks accordingly.
If you go to the 17:43 mark in my tutorial video, you’ll see how I use the “get object from JSON” block.
Thank you so much for your response!! It’s really helpful!! I will definitely try and check this out. Once again thank you so much for your help!
Your video worked! But thunkable, the platform itself actually has this runtime error that ruins it . Thank you anyway though, to everyone in this conversation!! Especially @tatiang !
Thunkable apps will crash if you try to get object properties that don’t exist (or from non-objects). If you’re getting a crash, it’s probably a problem with your blocks. Post them and the JSON if you want some help debugging.
Alright! I’ll send them shortly☺️