JSONUtils
Table of Contents
Class Definition
export abstract class JSONUtils {}
info
JSONUtils is an abstract utility class. All members are static — it cannot be instantiated directly.
Methods
safe()
static safe<T>(obj: T, space?: number): stringSerializes a value to a JSON string using
safe-stable-stringify, which handles circular references and non-deterministic key ordering safely.Parameters
Parameter Type Description Optional objT The value to serialize. spacenumber Indentation spaces for pretty-printing. Omit for compact output. Returns
Type Description string The serialized JSON string.
serializeTrack()
static serializeTrack(track: Track): stringSerializes a
Trackto a JSON string. Therequesterfield is reduced to{ id, username }to avoid circular references or non-serializable user objects.Parameters
Parameter Type Description Optional trackTrackThe track to serialize. Returns
Type Description string The JSON string representation of the track.