ImportJSON
ImportJSON copied to clipboard
Option to print empty values on unset requested paths
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 any chance you have solved this already? :) I have the same problem
@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 ok, thank you for the response.
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 ¯_(ツ)_/¯