Adding UTF-16 surrogate pair support for Json formatter

Hi,

The current JsonFormatter could not handle UTF-16 surrogate pair. It always throw an exception when trying to convert low surrogate char to UTF-32.

The change will get the index of each real character in the string instead of every code point.