Hello,
I’m a brand new user of Observable (it sounds so fantastic! Thanks for such a great platform!).
I have difficulty handling json according to my needs. I got lost with .nest .map etc.
I have a simple csv file. I load it into my notebook and the result below is displayed:
data = Array(x items) [
0: Object {header1: "value1", header2: "value2", header3: "value3", etc.}
1: Object {header1: "value1", header2: "value2", header3: "value3", etc.}
2: Object {header1: "value1", header2: "value2", header3: "value3", etc.}
...more
]
data = FileAttachment("mycsv.csv").csv()
I need to get a result like this:
jsonToDownload = Object {
value1: Object <!-- from data.object[0] => header1 --> {
header2: "value2"
header3: "value3"
etc.
}
value1: Object <!-- from data.object[1] => header1 --> {
header2: "value2"
header3: "value3"
etc.
}
value1: Object <!-- from data.object[2] => header1 --> {
header2: "value2"
header3: "value3"
etc.
}
...more
}
What’s the best way to do this?
Thanks in advance for helping out!