Improve performance of JSON string encoding for complex strings.

Unparse directly into the StringAccum.
Further speed up checking by simplifying log item comparison.