Represents the primitive types allowed in JSON according to RFC 7159. JSON primitives are: boolean, number, string, and null. Note that undefined is not a valid JSON primitive.
boolean
number
string
null
undefined
const jsonString: JsonPrimitive = "hello"; // ✓ validconst jsonNumber: JsonPrimitive = 42; // ✓ validconst jsonBoolean: JsonPrimitive = true; // ✓ validconst jsonNull: JsonPrimitive = null; // ✓ valid// const invalid: JsonPrimitive = undefined; // ✗ error Copy
const jsonString: JsonPrimitive = "hello"; // ✓ validconst jsonNumber: JsonPrimitive = 42; // ✓ validconst jsonBoolean: JsonPrimitive = true; // ✓ validconst jsonNull: JsonPrimitive = null; // ✓ valid// const invalid: JsonPrimitive = undefined; // ✗ error
Represents the primitive types allowed in JSON according to RFC 7159. JSON primitives are:
boolean,number,string, andnull. Note thatundefinedis not a valid JSON primitive.