Use less walrus for map function.

Walrus makes assumptions that the "doc" passed to the emit function is
a JS object, where this new code just assumes it's JSON parsable.

cbugg: close bug-435