API Connector not parsing JSON

I have a google cloud function that returns a JSON dictionary but bubble is parsing it as text and won’t allow me to choose JSON as the response type because “API returns non object and you choose JSON”

I have confirmed though POSTMAN that the response is indeed a properly formatted JSON object, then why does bubble not see it properly, what am I doing wrong?

1 Like

Here’s how the call is setup, notice how a dictionary object is being shown as text…

Whereas in postman, I can see that it’s returning a proper object:

Please help, thanks!

That’s because you’ve selected Text as the datatype.

If you want to it be a usable JSON object, select JSON.

1 Like

No! I’ve tried that, here’s what I see if I do that:

@Lacroo: Maybe try to enter response manually and try again.

I don’t seem to be able to save the manual response at all — save button is disabled:

That means it’s not valid JSON (which would explain the previous error message).

But it works perfectly fine on Postman… which is parsing it properly, screenshots attached.

NaN is not a valid JSON value

2 Likes

Right on! Looks like that’s the issue, I’ll have to modify the function to return empty where NaN, but that solves it (as per test), thank you so much Adam!

2 Likes