Json json.ts
Declarations #
8 declarations
Json #
Json
json_embed #
json_embed
<T>(data: T, stringify?: (data: T) => string): string Embeds data as a JSON string, escaping single quotes.
Useful for optimizing JSON in JS because it parses faster.
data
type
Tstringify
type
(data: T) => string default
JSON.stringifyreturns
string json_stringify_deterministic #
json_stringify_deterministic
(value: unknown): string Serializes a value to JSON with deterministic key ordering. Recursively sorts object keys alphabetically for consistent hashing. Arrays and primitives are serialized as-is.
value
Any JSON-serializable value
type
unknownreturns
string Deterministic JSON string representation
json_type_of #
json_type_of
(value: Json): JsonType | undefined Returns the JsonType of value, which is like typeof json
but includes 'array' and omits 'undefined'.
value
type Json
returns
JsonType | undefined JsonArray #
JsonArray
JsonArray inheritance
extends:
Array<Json>
JsonObject #
JsonObject
JsonObject inheritance
extends:
Record<string, Json>
JsonPrimitive #
JsonPrimitive
JsonPrimitive JsonType #
JsonType
JsonType Like typeof json, but includes arrays. Excludes 'undefined' because it's not valid JSON.