Fetch Column

The only thing with splitting it that way is that JSON doesn’t necessarily need to be structured with everything in a certain order. I mean, the hierarchy matters, but the order of items within a node could be in any order because each piece of data is qualified by name. If the json layout is stable, then you are pretty safe assuming the positions of each piece of data, but I wouldn’t assume that, as a json object could be updated in the future to include or exclude data. The only difference to what I was pointing out to Robert, is that jq query lets you specify which one (or possibly more) parts of the object you need. David’s other JSON Transformation column also lets you specify which parts you need, so you don’t have to rely on the structure of the JSON object always being the same. You just directly specify what you need out of that object and it will be returned, without relying on positions of everything in the json string.

6 Likes

Thanks for pointing that out. :exploding_head:

I will check out the other column and work on a better solution!!!

1 Like

Like this? So, theoretically, this will result in a snappier app?

4 Likes

Look at me learning stuff! @Jeff_Hager @david

5 Likes

image

Awesome! Even better that you can join multiple together! Probably a negligible speed improvement unless the api takes a long time to run on the remote server, but definitely reduces the load of having to run it multiple times.

Current Location works, too!

6 Likes

Wow! Did not know you could do that.

3 Likes

Right but I would try to return an array with all values and later using Single Value columns, choose and show the wished values reading the item position in array. This will apply in cases where I want to retrieve more than 4-5 values from JSON payload.

But, we have to modify/improve the David’s column/script to get an array. :facepunch:

Nice to see these ideas over here!.

1 Like

David’s JSON Transform column would do that. You pull in the entire JSON string which contains all of the values, and then pick out what you need using the transform column, just like you can with an array and single value columns. The JSON Transform is a lot safer since you don’t need to assume the position of data in the JSON strings. Instead it queries it like an object, as opposed to reading through it like an array. You can still perform a single api call to get the entire json, but have as many transform columns as you need to parse out the data you need.

1 Like

Yes!.. thinking it better, one can put several values separated by comma or slash and get an array using a Split Text column later:
E.g:

.[0].lat + "/" + .[0].lon + "/" + .[0].temp + "/" + .[1].temp + "/" + .[1].cityname

Saludos!

5 Likes

Ahh, I see what you’re saying. Yeah, that would work pretty good. You still have control over the number of elements in the array and what they are. That’s simpler than having several EC columns.

2 Likes

This was a helpful read:

6 Likes

Tried to get this working with the Google Places API Autocomplete but it errors, even though using the same URL in a browser returns a result, any ideas?

Google Places URL works in the browser:

Thanks a lot. :innocent:
Successfully fetched 3000 Street Addresses from Coordinates.

2 Likes

I’m able to fetch youtube data api v3 from URL and parse.

URL: https://www.googleapis.com/youtube/v3/videos?id={VIDEO_ID}&key={API_KEY}&part=snippet,contentDetails,statistics,status

For more Videos  |  YouTube Data API  |  Google Developers

3 Likes

More fun with Fetch!

LinkPreview API to grab featured title, description and image from any URL and display it in app:

6 Likes

I also getting the same error…any help on this?

It’s likely a CORS problem. I faced this many times and haven’t found out a way to get pass it.

1 Like

I have just read on CORS and it is beyond me. Maybe @david can help?

I also find it strange when I forked David’s GitHub, published the page and use it, I get this error below.errorforked

@ThinhDinh any insight of how to make this fetch column work? based as it is I have seen it worked twice…meaning I saw the values properly populated.
@Robert_Petitto was there any settings you did different to avoid the errors we had? I followed the video closely, but to no avail.

Thanks