bradjasper / ImportJSON

Import JSON into Google Sheets, this library adds various ImportJSON functions to your spreadsheet
GNU Lesser General Public License v3.0
2.11k stars 1.06k forks source link

Add option to return scalar arrays as arrays #1

Open fastfedora opened 12 years ago

fastfedora commented 12 years ago

Scalar arrays currently get collapsed into a single cell, with values separated by commas.

A use case exists where it would be better to return the values as an array. For instance:

{
   blah: "blah",
   aaData: [
      [
         "John",
         "Smith",
         "jsmith@example.com"
      ],
      [
         "Toby",
         "Harris",
         "tharris@example.com"
      ]
}

Currently calling ImportJSON with a query of "/aaData" returns a 1 x 1 array containing the value:

John,Smith,jsmith@example.com,Tody,Harris,tharris@example.com

Instead, there should be an option to return the values as a 3 x 2 array:

John | Smith  | jsmith@example.com
Tody | Harris | tharris@example.com
jenccnej commented 9 years ago

Hi! Is there any solution for scalar arrays?

fastfedora commented 9 years ago

No, not yet. I'm not actively developing the library any more. If others want to add this, I'd be happy to merge it in with the main branch.

aashishvanand commented 8 years ago

any updates about this enhancement.?

kenorb commented 6 years ago

Same here.

Example:

=ImportJSON("https://api.binance.com/api/v1/klines?symbol=BTCUSDT&interval=1m&limit=1", "", "")

Result:

1532979960000,8093.67000000,8093.67000000,8090.63000000,8090.64000000,17.01185600,1532980019999,137649.58791757,83,15.05237700,121794.23981272,0

Workaround:

=split(concatenate(ImportJSON("https://api.binance.com/api/v1/klines?symbol=BTCUSDT&interval=1m&limit=1")), ",")
pabloab commented 6 years ago

@kenorb How you would do with something multidimensional (3x3) like [["40290","BC","ALU"],["1","BC","GRAD"],["30","BC","STAFF"]]? There is a workaround in this case? If at least the merge was with a different character like a semicolon we could SPLIT two times.

Also I can't find the correct path (which look like an XPath but is not?) for for example get just the third column.

kenorb commented 6 years ago

@pabloab Unfortunatelly won't have time to help, so your best option is to ask at Webapps. Sorry.