The first argument to group-by
is a function. :severity
, in your third sample, is being used as a function, because keywords can be treated as functions: (:severity {:severity 1}) ;; => 1
.
Because strings cannot be treated as functions, you must use the alternate syntax to extract the value.
grouped-by-token (group-by #(% "severity") data)