-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Take only first value from list of returned values #67
Comments
@ronlut maybe check out https://gist.github.com/chrislkeller/5719258#gistcomment-2272498 => https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 which looks like it allows you to just select specific array items. |
@tordans Thanks. I'll take a look at it and create a pull request to merge it with this repo :) |
@tordans @ronlut did you get this to work, in the end? I'm trying to query my JSON results in the same way, but still get 'An array value cannot be found' errors. e.g. my working call is |
Hi @Calvinwuyts , It seems that the parameter in your function call may have two problems:
Below is the fixed code:
|
hi @allenyllee , thank you so much, that makes a bunch of sense! I got it to work perfectly. Thanks again! |
@Calvinwuyts Sorry for joining late, you can take a look at @allenyllee's solution integrated into this library by looking at #68 :) |
hiya @ronlut, thanks for the pull! |
I believe I'm seeing a sort of similar effect where the api call is returning all results that are equal or a subset of the query which is causing a little difficulty. Example: http://whattomine.com/coins/214.json returns
If I try to extract the value at
returns:
Is it possible to limit the return to the explicit item? |
Hi @mtompkins , |
@allenyllee Thank you, however, I do not see this resolving the issue. Perhaps I misunderstand its usage. If I try |
@mtompkins Try |
Your GIST has the same effect - all 4 are returned. |
@mtompkins No, just one! |
Using https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 |
Hi @mtompkins, sorry, I can not reproduce this issue.... |
So it's clearly a Google Sheets issue. I created a totally new document, pasted your GIST and it works as you have described. The old sheet doesn't seem to update the function / script correctly. What a pain! |
Try to get Google map API to sort a list of Costco locations. Thanks Anyway to get "San Bernardino County" for "types" : [ "administrative_area_level_2", "political" ]. { |
@allenyllee I'm using your gist https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 If I am using your example: My result is Biblionet no matter what I try (tried several accounts, opening different spreadsheets): while the result should have been: However when I change it to: I do get the correct answer (1688)! There seems to be a problem when the first argument is [0]. I'm asking because I want to use the Google Maps API. Whenever I use: The result is: While it should have been "United States": What am I doing wrong? |
@NickB23 Thanks for your report. You are right, this is an issue. Here is my fixed code https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4
Below is the test example which query from |
@allenyllee It's working now! Thanks! |
@allenyllee I'm using your gist - https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 While using the following example - I expect to get and I get the correct result that is = news However if I use the following I expect to get the result = news and 80-year-old medical marijuana patient with expired card jailed for less than an eighth of cannabis However I the get the entire data under /data[0]/children[0]. What am I doing wrong? |
Just input one path at a time, don't use comma separate with multiple path. So you need to separate your single request into two items: /data[0]/children[0]/subreddit and /data[0]/children[0]/title. |
Is there any way to use wildcards in pathing, or xpath like syntax "//name"? https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4#gistcomment-2704820 |
Hey I have the following Json array:
and when filtering by |
@Duartemartins your question seems the same as #67 (comment) Try my gist version: https://gist.github.com/allenyllee/c764c86ed722417948fc256b7a5077c4 |
Thanks! Yes that works if I change the query to |
Hi.
I am wondering whether it's somehow possible to take only first value (or value at location
i
) when receiving a list of values in json.For example, for this output:
I would like to get 1 using something like
/data/price/[0]
.Is this something currently possible?
Thanks
The text was updated successfully, but these errors were encountered: