Don't add empty fields to JSON output.

JSON output shouldn't use empty strings to signify a field does not exist, instead just don't include the field.  Also small update to escapeJSON so it doesn't modify the input string.