Copy-and-clear instead of detaching JSON StringBuffer

Summary: detach transfers ownership of the buffer to a String; but during JSON
decoding we always start with a 127-character buffer, so short strings end up
wasting a bunch of memory.  Copying gives us tightly allocated strings, and
clear just resets the internal length to zero, so we don't have to allocate a
new buffer.

Reviewed By: @markw65

Differential Revision: D1681172

Signature: t1:1681172:1415990188:2851b963a32ef54861557000bd229e3041ef9e05