Append the JSON representation of this object's data to a StringBuilder.
Note that when passing compact=false the generated string will
be human-readable and containing embedded newlines; also the
exact indentation etc may change, so use compact=true for a
target - the StringBuilder to append to.
the target passed in is also returned (to allow chaining).