Importing JSON data into Tableau where each column is a separate array

20 Views Asked by At

I receive data from the open-meteo API (for example: https://api.open-meteo.com/v1/forecast?latitude=52.377956&longitude=4.897070&hourly=temperature_2m,wind_speed_10m&past_days=10) in the following format:

{
  "latitude": 52.52,
  "longitude": 13.419,
  "elevation": 44.812,
  "generationtime_ms": 2.2119,
  "utc_offset_seconds": 0,
  "timezone": "Europe/Berlin",
  "timezone_abbreviation": "CEST",
  "hourly": {
    "time": ["2022-07-01T00:00", "2022-07-01T01:00", "2022-07-01T02:00", ...],
    "temperature_2m": [13, 12.7, 12.7, 12.5, 12.5, 12.8, 13, 12.9, 13.3, ...],
    "wind_speed_10m": [14.1, 15.1, 16.4, 15.4, 17.0, 17.1, 18.6, 20.2, 26.5, ...]
  },
  "hourly_units": {
    "time": "iso8601",
    "temperature_2m": "°C",
    "wind_speed_10m" : "km/h"
  }
}

Here the 'hourly' level contains three arrays with the same length, and these should be interpreted as three different columns in Tableau. However, when I import this file I get all combinations of data (so ~5million rows) because it expects the data points to be organised like:

[
{
 "time" : "2022-07-01T00:00",
 "temperature_2m" : 13,
 "wind_speed_10m" : 14.1
},
{
 "time" : "2022-07-01T01:00",
 "temperature_2m" : 12.7,
 "wind_speed_10m" : 15.1
},
...
]

How can I get Tableau to import the file correctly (I am not looking for solutions where we convert the structure in Python for example because this has to work for a low-code target audience).

0

There are 0 best solutions below