Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Add option to return scalar arrays as arrays #1

Open
fastfedora opened this issue Nov 14, 2012 · 6 comments
Open

Add option to return scalar arrays as arrays #1

fastfedora opened this issue Nov 14, 2012 · 6 comments

Comments

@fastfedora
Copy link
Collaborator

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
@ghost ghost assigned fastfedora May 6, 2013
@jenccnej
Copy link

Hi! Is there any solution for scalar arrays?

@fastfedora
Copy link
Collaborator Author

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
Copy link

any updates about this enhancement.?

@kenorb
Copy link
Contributor

kenorb commented Jul 30, 2018

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
Copy link

pabloab commented Sep 1, 2018

@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
Copy link
Contributor

kenorb commented Sep 6, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants