You need to put the key in quotes only when calling sortBy
. It doesn't have to be in quotes in the data itself.
_.sortBy(json, "key")
Also, your second parameter to map
is wrong. It should be a function, but using pluck
is easier.
_.pluck( _.sortBy(json, "key") , "value");