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.