Creates a JsonPrimitive from the given string, without surrounding it in quotes.

This function is provided for encoding raw JSON values that cannot be encoded using the JsonPrimitive functions. For example,

  • precise numeric values (avoiding floating-point precision errors associated with Double and Float),

  • large numbers,

  • or complex JSON objects.

Be aware that it is possible to create invalid JSON using this function.

Creating a literal unquoted value of null (as in, value == "null") is forbidden. If you want to create JSON null literal, use JsonNull object, otherwise, use JsonPrimitive.

See also

is the preferred method for encoding JSON primitives.



if value == "null"