I have the following R data frame:
Values
Type1 123
Type2 4565
Type3 7812
I expect the JSON output to be
{"Type1":123, "Type2":4565, "Type3":7812}
The number field can w/wo quote
I used jsonlite toJSON, the output is:
[{"Values":123,"_row":"Type1"},
{"Values": 4565,"_row":"Type2"},
{"Values": 7812,"_row":"Type3"}]
toJSON(as.list(setNames(df$Values,rownames(df))),auto_unbox=TRUE)
. – Gammadion