Change json::to_xxx(&Json) functions to be json::Json::to_xxx(&self)

to_str, to_pretty_str, to_writer, and to_pretty_writer were at the top
level of extra::json, this moves them into an impl for Json to match
with what's been done for the rest of libextra and libstd.  (or at least for vec and str)

Also meant changing some tests.

Closes #8676.