src.nth.io/

summaryrefslogtreecommitdiff
path: root/src/json.ts
blob: 53ab378eb38e04520635fdc2bc9a1e7ad1c28636 (plain)
1
2
3
4
5
6
7
8
/**
 * JSON serialization for command output. 64-bit values (node IDs, Matter
 * microsecond timestamps) are bigints internally and render as decimal
 * strings, never as lossy JavaScript numbers.
 */
export function toJsonString(value: unknown): string {
  return JSON.stringify(value, (_key, inner) => (typeof inner === "bigint" ? inner.toString() : inner), 2);
}