[Solved] Backendless Web API response object issue

Dear team, I’m having a hard time getting values from a response object provided by Web API from Backendless. It’s strange. I wonder what I might be doing wrong here:

First let me show you what I get when I put the whole response into a label:

{"lastLogin":1708577375153,"slices":90,"userStatus":"ENABLED","saved":null,"ownerId":"01AA8D65-ED84-76E9-FF2A-DADCE0CA9300","points":896,"shares":5,"pushId":null,"skips":null,"hearers":0,"seshes":3,"___class":"Users","theme":null,"blUserLocale":"en","speeds":4,"objectId":"01AA8D65-ED84-76E9-FF2A-DADCE0CA9300","email":"alice@yourmail.com","events":["Testing123", "TestingABC", "TestingXYZ"],"latest":null,"created":1707625253090,"accountType":"BACKENDLESS","streak":0,"socialAccount":"BACKENDLESS","oAuthIdentities":null,"friends":null,"special":100,"smthng":null,"name":null,"spoken":100,"location":null,"user-token":"CC7A0616-CE58-41D2-9701-1B2A1A868DBD","updated":1708569264064,"mark":"01AA8D65"}

These are the blocks that got the above response:

I get a “null” when I try it 2 different ways below:

Even with the Get block for the SaveObjectAPI, I get a null:

I’m getting these same results on both web app and ios Live Testing. Thanks for any help.

You’re not parsing the JSON correctly. The “message”, “userID” and “userId” properties do not exist in the JSON response you’re getting back from the API server.

If it’s helpful, you can review my API tutorial at API JSON Tutorial (Video).

Here are some steps to try:

  1. Whenever you get a property of an object, you need to make sure it’s actually an object you’re attaching. The green response block for an API returns JSON or an error. It does not return an object. So you’ll need to include the get object from JSON block. You did that in some cases but not in every case.

  2. Format your JSON on the forums by using the </> button in the toolbar. This fixes smart quotes. I went ahead and did that for you in your post.

  3. Copy the full JSON response text and paste it into Best JSON Viewer and JSON Beautifier Online. That will create a “tree” view of your data which is much easier to understand and which allows you to click on a property name (such as “slices” in this screenshot) and view the path to that property at the top:


  1. Decide which properties you need and determine their paths using step #2 above. For each path, use a get property of object block. The name of the property should be the path to the property name on Best JSON Viewer and JSON Beautifier Online. For example, to get the slices value, you would get the property named “slices”. To get the first item of the events property array/list, you would get the property named “events[1]”.

  2. Test and post screenshots if it’s still not working.

Thank you for coming to my rescue! I’m sorry about the confusion. I sorta gave you a bad example there with the userId property as I had tried many of the other properties using the Get Block which is the one that’s really been giving problems. I confused myself there as well by trying to test the userId property which I assumed would be there too. Thanks for helping me to confirm that the response object from the Login API works well. What a relief! Please help me to figure out the Get block though. I get null for everything I’ve tried with it so far.

This is what I get when I put the whole JSON response into the label:

[{"lastLogin":1708581309000,"slices":90,"userStatus":"ENABLED","saved":null,"ownerId":"01AA8D65-ED84-76E9-FF2A-DADCE0CA9300","points":896,"shares":5,"pushId":null,"skips":null,"hearers":0,"seshes":3,"___class":"Users","theme":null,"blUserLocale":"en","speeds":4,"objectId":"01AA8D65-ED84-76E9-FF2A-DADCE0CA9300","email":"alice@yourmail.com","events":["Testing123", "TestingABC", "TestingXYZ"],"latest":null,"created":1707625253090,"accountType":"BACKENDLESS","streak":0,"socialAccount":"BACKENDLESS","oAuthIdentities":null,"friends":null,"special":100,"smthng":null,"name":null,"spoken":100,"location":null,"updated":1708580921464,"mark":"01AA8D65"}]

Here are the blocks I used:

I tried using the tool that you provided. Here’s an example where I try to get the email property:

I went through your JSON tutorial before, I think it’s the Array part that is tricky here. (Also, the response only has a message property if there is an error.)

I just figured it out! Thank you! All I needed was a helping hand. Thanks again man!

That clears it all up! Peace be with you! God bless! (Please let me know if there is a better way to do this?)

1 Like

You’re welcome! Glad it’s working now.

What you have is good. I prefer to use “[1].mark” for the property name but that doesn’t mean it’s “the right way” to do it. It’s just another way.

1 Like