Added a convenience version of toPrettyJson() that returns a string + fixed typos.