Split parseJSON into parseJSONValue and toJSONValue.

 - parseJSONValue leaves any excess tokens in the input stream
 - toJSONValue throws an exception if any non-whitespace characters follow the JSON document