I have a tibble/dataframe that look like this:
aspect Col1 Col2 Col3 Col4
ac1 0 2.874891e-05 0.0089479233 -0.0603030498
ac2 0 1.666263e-06 0.0057062434 0
ac3 0 -1.146331e-06 0.0171818879 0
ac4 0 -1.238803e-05 0.0115160832 0
ac5 0 -9.875351e-06 0.0107672657 0
am1 0 -2.851165e-07 0.0005078577 -0.0332858477
am2 0 1.650766e-06 0.0009922302 0.0659597726
am3 0 -2.727834e-06 -0.0002062687 -0.1169132561
am4 0 8.890657e-07 0.0016247214 0.0118325964
am5 0 1.705298e-06 0.0008613693 -0.1069581186
I want to create a JSON where aspect column is the "key" and the rest of the columns are the key:values: col1:value1 col2:value1
...
I am trying to play with toJSON and data.frame = "rows" attribute but without luck.
Please advise.
The desired output should be like this:
[{"aspect":"ac1","col1":0,"col2":0,"col3":0.00=
89,"col4":-0.0603}, .....]