Allow JsonParse to parse primitives at top level

Also, add JsonPrimitiveTypeToString

cherry-picked from 2c49abaa5d98edee3c053eab73c7fdb7f6223f01