Wie öffne ich diese JSON-Datei als Datentabelle?Ich benötige Hilfe beim Öffnen dieser JSON-Datei in JMP als Datentabelle: https://www.purpleair.com/data.json
Ich habe den JSON-Importassistenten von JMP verwendet, konnte die Datei jedoch nicht wie gewünscht öffnen.
Ich möchte, dass die "Felder" die Spaltenüberschriften und "Daten" die Zeilen in der Datentabelle sind. Ich schätze Ihre Hilfe im Voraus.
DatentabelleSkriptingRe: Wie öffne ich diese JSON-Datei als Datentabelle?Höchstwahrscheinlich gibt es bessere Möglichkeiten, dies zu handhaben, aber hier ist eine mögliche Lösung (erfordert JMP16 aufgrund von For Each):
Names Default To Here(1);
s = New HTTP Request(
url("https://www.purpleair.com/data.json"),
Method("GET"),
Headers({"Accept: application/json"})
) << Send;
aa_json = Associative Array(Parse JSON(s));
//aa_json << get keys;
//aa_json["fields"];
//Create collection table and columns
dt = New Table("json");
For Each({new_col}, aa_json["fields"],
dt << New Column(new_col);
);
Column(dt, "Label") << Data Type("Character"); //character columns must be set "manually"
//Fill rows
row_count = N Items(aa_json["data"]);
dt << Add Rows(row_count);
dt[0,0] = aa_json["data"];
Write(); //empty Write() to avoid printing all values to log
Re: Wie öffne ich diese JSON-Datei als Datentabelle?nett!
Betreff: Wie öffne ich diese JSON-Datei als Datentabelle?Vielen Dank @jthi !