Split header and body in call to `writeJSON`.

Split the header and body out of the entry so that I can implement a
binary replacement of `writeJSON` that treats the body not an element in
the header but as a buffer of binary data to be written separately.

Closes #212.