I have this Excel table:
country year 1 2 3 4 Netherlands 1970 3603 4330 5080 5820 Netherlands 1971 3436 4165 4929
You can download a set of classes that convert excel data to JSON from here. http://ramblings.mcpher.com/Home/excelquirks/downloadlist. The project you want is 'Data manipulation classes'.
Using these classes, this code
Option Explicit
Public Sub mainExample()
Dim dSet As cDataSet
Set dSet = New cDataSet
With dSet
.populateData Range("data!$a$1"), , , , , , True
If .Where Is Nothing Then
MsgBox ("No data to process")
Else
MsgBox .jSonObject
End If
End With
End Sub
is all thats needed to produce this from your data.
{ "data": {
"country": "Sweden",
"year": "1972",
"1": "1419",
"2": "1894",
"3": "2445",
"4": "3055"
}
}
You can do more complex things, or tailor the output, after reading this article on how it works. http://ramblings.mcpher.com/Home/excelquirks/recursionlink/hiding-data-in-excel-objects
bruce