ImportJSON icon indicating copy to clipboard operation
ImportJSON copied to clipboard

Option to print empty values on unset requested paths

Open SharkWipf opened this issue 6 years ago • 4 comments

I'm currently trying to work with a pretty unpredictable API that, depending on the things I request, returns different paths.
For instance, one call for a product will return size, weight, price, name, etc.
Another product returns only price and name.
If you were to import it like:

size | weight | price | name
=ImportJSON("https://api.com/product1", "/size,/weight,/price,/name", "noHeaders")
=ImportJSON("https://api.com/product2", "/size,/weight,/price,/name", "noHeaders")

You'd end up with something like

size | weight | price | name
32   | 10kg   | $80   | blouse
$42  | carrot |       |

Note how price and name shifted to the size and weight fields. A parseOption to include unset paths in the output as well would solve this problem.

SharkWipf avatar Aug 23 '17 01:08 SharkWipf

@SharkWipf any chance you have solved this already? :) I have the same problem

Strajk avatar Dec 03 '19 14:12 Strajk

@Strajk sadly not, shortly after running into this I moved to a 3rd party application that did the same thing as my sheet but way better.

SharkWipf avatar Dec 03 '19 20:12 SharkWipf

@SharkWipf ok, thank you for the response.

Strajk avatar Dec 08 '19 08:12 Strajk

Just found out that this works :yay:

=ImportJSON(«url», "/a,/b,/c", "allHeaders,noHeaders")

"allHeaders,noHeaders" sounds little bit schizophrenic, but it does the job ¯_(ツ)_/¯

Strajk avatar Mar 10 '20 19:03 Strajk