New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rows missing when parsing some arrays #8

Closed
fastfedora opened this Issue Aug 28, 2014 · 10 comments

Comments

Projects
None yet
9 participants
@fastfedora
Collaborator

fastfedora commented Aug 28, 2014

This data set is not returning all of its rows when queried with the query “/facets/name,/facets/fields/label,/facets/fields/count”.

The problem is that the /facets/fields is skipping rows from 'name:LANGUAGE', 'name:TYPE' and 'name:YEAR' among others. It is also merging in the wrong value for /facets/name.

View this sample spreadsheet that uses the following call:

=ImportJSON(“http://europeana.eu/api//v2/search.json?wskey=ISXVIQBYBQ&query=*:*&start=1&rows=0&profile=facets”, 
            “/facets/name,/facets/fields/label,/facets/fields/count”, 
            “noTruncate”)`
@kenorb

This comment has been minimized.

Show comment
Hide comment
@kenorb

kenorb Jan 28, 2015

Contributor

It seems to happen for most of the feeds. The first row is always ignored.

Example feeds:

http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?v=2&alt=json
https://api.github.com/repos/mycognitive/ads/issues
Contributor

kenorb commented Jan 28, 2015

It seems to happen for most of the feeds. The first row is always ignored.

Example feeds:

http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?v=2&alt=json
https://api.github.com/repos/mycognitive/ads/issues
@myktra

This comment has been minimized.

Show comment
Hide comment
@myktra

myktra Feb 5, 2015

I'm observing this as well. First row in array is ignored unless the number of objects in the array returned by the feed is 1. Even on something as simple as the following JSON - only the second row is returned.

[{"Amount":"8,996.00"},{"Amount":"3,802.00"}]

=ImportJSON("http://...", "", "noInherit")

Amount
3,802.00

FWIW, changing the result output slightly doesn't matter:

{ count: 2, results: [{"Amount":"8,996.00"},{"Amount":"3,802.00"}] }

=ImportJSON("http://...", "/results", "noInherit")

Amount
3,802.00

myktra commented Feb 5, 2015

I'm observing this as well. First row in array is ignored unless the number of objects in the array returned by the feed is 1. Even on something as simple as the following JSON - only the second row is returned.

[{"Amount":"8,996.00"},{"Amount":"3,802.00"}]

=ImportJSON("http://...", "", "noInherit")

Amount
3,802.00

FWIW, changing the result output slightly doesn't matter:

{ count: 2, results: [{"Amount":"8,996.00"},{"Amount":"3,802.00"}] }

=ImportJSON("http://...", "/results", "noInherit")

Amount
3,802.00
@Zyles

This comment has been minimized.

Show comment
Hide comment
@Zyles

Zyles Apr 30, 2015

Suffering from this bug:

=importJSON("https://api.guildwars2.com/v1/recipe_details.json?recipe_id=515", "/ingredients")

There are 3 ingredients, and output is 2.

Makes this script completely unusable for me. :/

Zyles commented Apr 30, 2015

Suffering from this bug:

=importJSON("https://api.guildwars2.com/v1/recipe_details.json?recipe_id=515", "/ingredients")

There are 3 ingredients, and output is 2.

Makes this script completely unusable for me. :/

@macolo

This comment has been minimized.

Show comment
Hide comment
@macolo

macolo May 4, 2015

I tracked it down to https://github.com/mhawksey/google-docs/blob/master/scripts/ImportJSON/Code.gs#L286

(the 'i > 0' part)

which I removed and it started to work.

Here is my test case in GAS:

https://gist.github.com/macolo/6834dee326547f93194a

macolo commented May 4, 2015

I tracked it down to https://github.com/mhawksey/google-docs/blob/master/scripts/ImportJSON/Code.gs#L286

(the 'i > 0' part)

which I removed and it started to work.

Here is my test case in GAS:

https://gist.github.com/macolo/6834dee326547f93194a

kenorb referenced this issue in mhawksey/google-docs Sep 28, 2015

Fixed a bug with how nested arrays are handled
Fixed a bug with how nested arrays are handled. The rowIndex counter wasn't incrementing properly when parsing.

kenorb added a commit to kenorb-contrib/google-docs that referenced this issue Sep 28, 2015

@kenorb

This comment has been minimized.

Show comment
Hide comment
@kenorb

kenorb Sep 28, 2015

Contributor

Good catch @macolo. Did the blind fix and PR mhawksey#1, please test. Hopefully it will work:)

Contributor

kenorb commented Sep 28, 2015

Good catch @macolo. Did the blind fix and PR mhawksey#1, please test. Hopefully it will work:)

@fastfedora

This comment has been minimized.

Show comment
Hide comment
@fastfedora

fastfedora Sep 29, 2015

Collaborator

@kenorb You can actually remove i >= 0 &&, since i is always equal to or greater than 0. Until I have time to analyze why I put this test in there to begin with, I'm leaving it in the codebase and letting people who are experiencing this specific problem remove it manually.

Collaborator

fastfedora commented Sep 29, 2015

@kenorb You can actually remove i >= 0 &&, since i is always equal to or greater than 0. Until I have time to analyze why I put this test in there to begin with, I'm leaving it in the codebase and letting people who are experiencing this specific problem remove it manually.

@ryantheleach

This comment has been minimized.

Show comment
Hide comment
@ryantheleach

ryantheleach Nov 12, 2015

I ran into this bug, and fixed it the same way after spending far too much time analysing it instead of checking github issues. Would be good to merge it in..

ryantheleach commented Nov 12, 2015

I ran into this bug, and fixed it the same way after spending far too much time analysing it instead of checking github issues. Would be good to merge it in..

@Artanis

This comment has been minimized.

Show comment
Hide comment
@Artanis

Artanis commented Nov 16, 2015

@sknepal

This comment has been minimized.

Show comment
Hide comment
@sknepal

sknepal Jan 18, 2016

Same as @ryantheleach. Spent too much time tracking it down, and when I finally solved it (the same way), I saw this issue. Should have checked out the issues earlier. Maybe its time to merge or maybe, at least a sort of hint in the comments / readme?

sknepal commented Jan 18, 2016

Same as @ryantheleach. Spent too much time tracking it down, and when I finally solved it (the same way), I saw this issue. Should have checked out the issues earlier. Maybe its time to merge or maybe, at least a sort of hint in the comments / readme?

alaq added a commit to alaq/google-docs that referenced this issue Jun 12, 2017

bradjasper added a commit that referenced this issue Jul 24, 2017

@bradjasper

This comment has been minimized.

Show comment
Hide comment
@bradjasper

bradjasper Jul 24, 2017

Owner

This was merged in #18

Owner

bradjasper commented Jul 24, 2017

This was merged in #18

@bradjasper bradjasper closed this Jul 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment