This is the closest I got
npm freezelol
npm ls | grep -E "^(├|└)─" | cut -d" " -f2 | awk -v quote=""" 'BEGIN { FS = "@" } ; { print quote $1 quote,":",quote $2 quote"," }' | sed -e 's/ :/:/g'
Output is like
"bower": "1.3.12",
"chai": "2.1.2",
"cucumber": "0.4.8",
Still needs to trim the final trailing comma but it’s pretty close!