I would like to build an Excel VBA macro for this JSON example
{
"type": "LineString",
"coordinates": [
[
-67.8014083333333,
-10.0068666666667
],
[
-67.8014083333333,
-10.0068666666667
],
[
-67.8014083333333,
-10.0068666666667
],
[
-67.8014166666667,
-10.0068583333333
],
[
-67.8014166666667,
-10.0068583333333
]
]
}
VBA code:
Sub JSON()
Dim FSO As New FileSystemObject
Dim JsonTS As TextStream
Dim JsonText As String
Dim Parsed As New Dictionary
' Read .json file
Set JsonTS = FSO.OpenTextFile("XXXXX.json", ForReading)
JsonText = JsonTS.ReadAll
JsonTS.Close
' MsgBox JsonText
' Parse json to Dictionary
' "values" is parsed as Collection
' each item in "values" is parsed as Dictionary
Set Parsed = JsonConverter.ParseJson(JsonText)
MsgBox Parsed(1)
End Sub
Comments
Post a Comment