Ich habe viele JSON-Addins für Excel ausprobiert, aber ich habe kein Glück, die JSON-Daten unten zu analysieren. endlich habe ich es geschafft, den Code unterWie bekomme ich einen Wert von verschachtelten/versetzten Excel-Objekt - Daten von JSON
Sub jsonDecode()
Dim jsonDecode As Variant
jsonText = Worksheets("Sheet3").Range("A1").Value
Set sc = CreateObject("ScriptControl"): sc.Language = "JScript"
Set jsonDecode = sc.Eval("(" + jsonText + ")")
End Sub
zu verwenden, um eine gestaffelte Objekt zu erstellen, kann aber nicht die Werte im Bild unten zuzugreifen. Ich habe die für den Code geschätzt Jede Hilfe wäre wirklich
msgbox(jsonDecode.location.id)
msgbox(tostring(jsonDecode.location.id))
msgbox(jsonDecode(location(id)))
folgende versucht, die Werte mit A und B im Bild unten :) Verzeihen Sie mir, wenn meine Terminologie ist ein bisschen skewif
zu erhalten Prost!!
Image of the array tree in Excel locals window
JSON Text ist
{ "Lage": { "id": 2456, "name": "Tuggerah", "Region": "Central Coast", "Zustand":“ NSW "," Postleitzahl ":" 2259 "," timeZone ":" Australien/Sydney "," lat ": - 33.30701," lng ": 151.4159," typeId ": 1}," Prognosen ": {" weather ": {"Tage": [{"dateTime": "2016-09-13 00:00:00", "entries": [{"dateTime": "2016-09-13 00:00:00", "precisCode" : "duschen-regen", "precis": "Späten regen", "precisOverlayCode": "", "nacht": falsch, "min": 10, "max": 22}]}], "units": { "Temperatur": "c"}, "issueDateTime": "2016-09-13 11:35:20"}, "wind": {"Tage": [{"dateTime": "2016-09-13 00: 00:00 "," Einträge ": [{" dateTime ":" 2016-09-13 00:00:00 "," Geschwindigkeit ": 9.1," Richtung ": 287," directionText ":" WNW "}, {" dateTime ":" 2016-09-13 01:00:00 "," Geschwindigkeit ": 9.3," Richtung ": 258," directionText ":" WSW "}, {" dateTime " : "2016-09-13 02:00:00", "Geschwindigkeit": 9.3, "Richtung": 256, "directionText": "WSW"}, {"dateTime": "2016-09-13 03:00: 00 "," Geschwindigkeit ": 9.1," Richtung ": 254," directionText ":" WSW "}, {" dateTime ":" 2016-09-13 04:00:00 "," Geschwindigkeit ": 6.9," Richtung ": 260," directionText ":" W "}, {" dateTime ":" 2016-09-13 05:00:00 "," Geschwindigkeit ": 5,7," Richtung ": 256," directionText ":" WSW " }, {"dateTime": "2016-09-13 06:00:00", "Geschwindigkeit": 5.7, "Richtung": 249, "directionText": "WSW"}, {"dateTime": "2016-09 -13 07:00:00 "," Geschwindigkeit ": 5.9," Richtung ": 245," directionText ":" WSW "}, {" dateTime ":" 2016-09-13 08:00:00 "," Geschwindigkeit ": 5.2," Richtung ": 254," directionText ":" WSW "}, {" dateTime ":" 2016-09-13 09:00:00 "," Geschwindigkeit ": 4.6," direction ": 272," directionText ":" W "}, {" dateTime ":" 2016-09-13 10:00:00 "," Geschwindigkeit ": 4.6," Richtung ": 281," directionText ":" W "}, {" dateTime ":" 2016-09-13 11:00:00 "," Geschwindigkeit ": 6.1," Richtung ": 312," directionText ":" NW "}, {" dateTime ":" 2016-09-13 12:00 : 00 "," Geschwindigkeit ": 8," Richtung ": 14," Richt ectionText ":" NNE "}, {" dateTime ":" 2016-09-13 13:00:00 "," Geschwindigkeit ": 9.6," Richtung ": 45," directionText ":" NE "}, {" dateTime ":" 2016-09-13 14:00:00 "," Geschwindigkeit ": 9.8," Richtung ": 56," directionText ":" NE "}, {" dateTime ":" 2016-09-13 15:00 : 00 "," Geschwindigkeit ": 9.6," Richtung ": 77," directionText ":" ENE "}, {" dateTime ":" 2016-09-13 16:00:00 "," Geschwindigkeit ": 9.4," Richtung ": 88," directionText ":" E "}, {" dateTime ":" 2016-09-13 17:00:00 "," Geschwindigkeit ": 10.7," Richtung ": 73," directionText ":" ENE "}, {" dateTime ":" 2016-09-13 18:00:00 "," Geschwindigkeit ": 11.9," Richtung ": 43," directionText ":" NE "}, {" dateTime ":" 2016- 09-13 19:00:00 "," Geschwindigkeit ": 12.6," Richtung ": 28," directionText ":" NNE "}, {" dateTime ":" 2016-09-13 20:00:00 "," " Geschwindigkeit ": 11.7," Richtung ": 11," directionText ":" N "}, {" dateTime ":" 2016-09-13 21:00:00 "," Geschwindigkeit ": 9.8," Richtung ": 336, "directionText": "NNW"}, {"dateTime": "2016-09-13 22:00:00", "Geschwindigkeit": 7.8, "Richtung": 318, "directionText": "NW"}, {" dateTime ":" 2016-09-13 23:00:00 "," Geschwindigkeit ": 4.6," Richtung ": 304," directionText ":" NW "}]}]," Einheiten ": {" speed ":" km/h "}," issueDateTime ":" 2016-09-13 12: 11:55 "}}," precedentGraphs ": {" temperature ": {" dataConfig ": {" serie ": {" config ": {" id ":" temperature "," farbe ":" # 003355 "," lineWidth ": 2," lineFill ": false," lineRenderer ":" StraightLineRenderer "," showPoints ": false," pointFormatter ":" TemperaturePointFormatter "}," yAxisDataMin ": 10.7," yAxisDataMax ": 22.2," yAxisMin ": 0, "yAxisMax": 32, "groups": [{"dateTime": 1473724800, "points": [{"x": 1473724800, "y": 12.4}, {"x": 1473728400, "y": 11.7}, {"x": 1473732000, "y": 11.3}, {"x": 1473735600, "y": 11}, {"x": 1473739200, "y": 10.9}, {"x": 1473742800, "y": 10.7}, {"x": 1473746400, "y": 11}, {"x": 1473750000, "y": 12.2}, {"x": 1473753600, "y": 14.2} , {"x": 1473757200, "y": 16.8}, {"x": 1473760800, "y": 19.3}, {"x": 1473764400, "y": 21}, {"x": 1473768000, "y": 21.9}, {"x": 1473771600, "y": 22.2}, {"x": 1473775200, "y": 22.2}, {"x": 1473778800, "y": 21.7}, { "x": 1473782400, "y": 20,7}, {"x": 1473786000, "y": 19.1}, {"x": 1473789600, "y": 17.6}, {"x": 1473793200, "y": 16.1}, {"x": 1473796800, "y": 15.3}, {"x": 1473800400, "y": 14.9}, {"x": 1473804000, "y": 14.6}, {"x": 1473807600, "y": 14.1}]}], "Kontrollpunkte": {"pre": { "x": 1473721200, "y": 10.2}, "post": {"x": 1473811200, "y": 13.7}}}, "xAxisMin": 1473724800, "xAxisMax": 1473811199}, "Einheiten": {"Temperatur": "c"}, "issueDateTime": "2016-09-13 07:21:53", "nextIssueDateTime": "2016-09-13 08:21:53"}, "precis": { "dataConfig": {"series": {"config": {"id": "precis", "lineFill": false, "showPoints": true, "pointRenderer": "PrecisSummaryPointRenderer", "pointFormatter": "PrecisSummaryPointFormatter" }, "groups": [{"dateTime": 1473724800, "points": [{"x": 1473728400, "precisCode": "teilweise bewölkt", "Nacht": true}, {"x": 1473739200, "precisCode": "Nebel", "Nacht": true}, {"x": 1473750000, "precisCode": "meist bewölkt", "Nacht": falsch}, {"x": 1473760800, "precisCode": "mostly-wolkig", "Nacht": falsch}, {"x": 1473771600, "precisCode": "meist bewölkt", "Nacht": falsch}, {"x": 1473782400, "precisCode": "meistens -cloudy "," Nacht ": falsch}, {" x ": 1473793200," precis Code ":" chance-dusche-wolke "," nacht ": true}, {" x ": 1473804000," precisCode ":" duschen-regen "," nacht ": wahr}]}]," controlPoints ": [ ]}, "xAxisMin": 1473724800, "xAxisMax": 1473811199}}}, "beobachtend": {"beobachtungen": {"temperature": {"temperature": 18.5, "scheinbareTemperatur": 17.4, "trend": - 1}, "Feuchtigkeit": {"Prozent": 87}, "Taupunkt": {"Temperatur": 16,3, "Trend": 1}, "Druck": {"Druck": 1019,3, "Trend": null} , "Wind": {"Geschwindigkeit": 16.7, "bustgeschwindigkeit": 20.4, "Trend": 0, "Richtung": 202.5, "directionText": "SSW"}, "Niederschlag": {"lastHourAmount": 0, "todayAmount": 0, "since9AMAmount": 0}}, "stations": {"temperature": {"name": "Norah Kopf AWS", "distance": 15.5}, "pressure": {"name": "Norah Head AWS", "Entfernung": 15.5}, "Wind": {"Name": "Norah Head AWS", "Entfernung": 15.5}, "Niederschlag": {"name": "Norah Head AWS", "distance": 15.5}}, "issueDateTime": "2016-09-13 12:20:00", "units": {"temperature": "c", "betrag": "mm", "speed": "km/h", "Entfernung": "km", "Druck": "hPa"}}, "Beobachtungsgraphen": {"press": {"dataConfig": {"series": {"config": {" id ":" Druck "," Farbe ":" # 0033 55 "," lineWidth ": 2," lineFill ": false," lineRenderer ":" StraightLineRenderer "," showPoints ": false," pointFormatter ":" PressurePointFormatter "}," yAxisDataMin ": 1018.2," yAxisDataMax ": 1020.9, "yAxisMin": 850, "yAxisMax": 1100, "Gruppen": [{"dateTime": 1473724800, "points": [{"x": 1473724800, "y": 1019.4}, {"x": 1473728400, "y": 1019,9}, {"x": 1473730200, "y": 1019,4}, {"x": 1473732000, "y": 1019.1}, {"x": 1473733800, "y": 1018.7}, { "x": 1473735600, "y": 1018.2}, {"x": 1473737400, "y": 1018.5}, {"x": 1473739200, "y": 1018.8}, {"x": 1473741000, "y ": 1019.1}, {" x ": 1473742800," y ": 1019.1}, {" x ": 1473744600," y ": 1019.3}, {" x ": 1473746400," y ": 1019.7}, {" x ": 1473748200," y ": 1020}, {" x ": 1473750000," y ": 1020.1}, {" x ": 1473751800," y ": 1020.5}, {" x ": 1473753600," y ": 1020,9}, {"x": 1473755400, "y": 1020,9}, {"x": 1473757200, "y": 1020,9}, {"x": 1473759000, "y": 1020.4}, {"x": 1473760800, "y": 1020.4}, {"x": 1473762600, "y": 1020.5}, {"x": 1473764400, "y": 1020.5}, {"x": 1473766200, "y": 1019.8} , {"x": 1473768000, "y": 1019.3}]}], "controlPoints": []}, "xAxisMin": 1473724800, "xAxisMax": 1473897599}, "Einheiten": { "Druck": "hpa"}, "Anbieter": {"id": 329, "Name": "Norah Head AWS", "lat": - 33,28, "lng": 151,58, "Abstand": 15,5, " Einheiten ": {" Abstand ":" km "}}}," Temperatur ": {" dataConfig ": {" Serie ": {" config ": {" id ":" Temperatur "," Farbe ":" # 003355 "," lineWidth ": 2," lineFill ": false," lineRenderer ":" StraightLineRenderer "," showPoints ": false," pointFormatter ":" TemperaturePointFormatter "}," yAxisDataMin ": 15.1," yAxisDataMax ": 20.1," yAxisMin ": 0," yAxisMax ": 32," groups ": [{" dateTime ": 1473724800," points ": [{" x ": 1473724800," y ": 15.6}, {" x ": 1473725400," y ": 16.1}, {" x ": 1473726000," y ": 16.1}, {" x ": 1473726600," y ": 16.1}, {" x ": 1473727200," y ": 15.8}, {" x ": 1473727800," y ": 15.9}, {" x ": 1473728400," y ": 16}, {" x ": 1473729000," y ": 15.9}, {" x ": 1473729600," y " : 15.9}, {"x": 1473730200, "y": 15.8}, {"x": 1473730800, "y": 15.6}, {"x": 1473731400, "y": 15.4}, {"x" : 1473732000, "y": 15.4}, {"x": 1473732600, "y": 15.4}, {"x": 1473733200, "y": 15.5}, {"x": 1473733800, "y": 15.3 }, {"x": 1473734400, "y": 15.3}, {"x": 1473735000, "y": 15.1}, {"x": 1473735600, "y": 15.3}, {"x": 1473736200 , "y": 15.3}, {"x": 1473736800, "y" : 15.5}, {"x": 1473737400, "y": 15.5}, {"x": 1473738000, "y": 15.5}, {"x": 1473738600, "y": 15.4}, {"x" : 1473739200, "y": 15.5}, {"x": 1473739800, "y": 15.6}, {"x": 1473740400, "y": 15.7}, {"x": 1473741000, "y": 15.8 }, {"x": 1473741600, "y": 15.9}, {"x": 1473742200, "y": 16.1}, {"x": 1473742800, "y": 16.2}, {"x": 1473743400 , "y": 16,4}, {"x": 1473744000, "y": 16,4}, {"x": 1473744600, "y": 16,4}, {"x": 1473745200, "y": 16,4}, {"x": 1473745800, "y": 16,3}, {"x": 1473746400, "y": 16,3}, {"x": 1473747000, "y": 16,4}, {"x": 1473747600, " y ": 16.4}, {" x ": 1473748200," y ": 16.5}, {" x ": 1473748800," y ": 16.6}, {" x ": 1473749400," y ": 16.8}, {" x ": 1473750000," y ": 16.8}, {" x ": 1473750600," y ": 16.9}, {" x ": 1473751200," y ": 17}, {" x ": 1473751800," y " : 17.1}, {"x": 1473752400, "y": 17.4}, {"x": 1473753000, "y": 17.4}, {"x": 1473753600, "y": 17.6}, {"x" : 1473754200, "y": 17,9}, {"x": 1473754800, "y": 17,9}, {"x": 1473755400, "y": 17,9}, {"x": 1473756000, "y": 17.9 }, {"x": 1473756600, "y": 18.2}, {"x": 1473757200, "y": 18.2}, {"x": 1473757800, "y": 18.3}, {"x": 1473758400 , "y": 18,2}, {"x": 1473759000, "y": 18,3}, {"x": 1473759600, "y": 18.4}, {"x": 1473760200, "y": 18,6}, {"x": 1473760800, "y": 18,8}, {"x": 1473761400, "y": 18,7}, {"x": 1473762000, "y": 18.6}, {"x": 1473762600, "y": 18.4}, {"x": 1473763200, "y": 18.6}, {"x": 1473763800, "y": 19.2} , {"x": 1473764400, "y": 20.1}, {"x": 1473765000, "y": 19.6}, {"x": 1473765600, "y": 20.1}, {"x": 1473766200, "y": 20}, {"x": 1473766800, "y": 20,1}, {"x": 1473767400, "y": 19,2}, {"x": 1473768000, "y": 18.8}, { "x": 1473768600, "y": 18.6}, {"x": 1473769200, "y": 18.5}]}], "Kontrollpunkte": []}, "xAxisMin": 1473724800, "xAxisMax": 1473897599} , "Einheiten": {"Temperatur": "c"}, "Anbieter": {"ID": 329, "Name": "Norah Head AWS", "Lat": - 33,28, "Lng": 151,58, " distance ": 15.5," units ": {" distance ":" km "}}}}," regionPrecis ": {" Tage ": [{" dateTime ":" 2016-09-13 00:00:00 ", "entries": [{"dateTime": "2016-09-13 00:00:00", "precis": "Wolkig. Unruhiger Nebel heute Morgen. Hohe (70%) Chance auf Regen am späten Abend. Licht die Winde werden am späten Nachmittag 15 bis 20 km/h nordöstlich, am Abend dann nördlicher. "}]}}," issueDateTime ":" 2016-09-13 10:41:16 "," name ":" Central Coa "
Prost für das. Ich werde versuchen, die aktualisierte (Get and Transform) Version, die mit Excel 2016 kommt, und lassen Sie wissen, wie ich komme. –