@beenotung/tslib
Version:
utils library in Typescript
24 lines (23 loc) • 779 B
TypeScript
export type JsonPrimitive = string | number | null | boolean;
export interface JsonObject {
[key: string]: JsonValue;
}
export interface JsonArray {
readonly length: number;
[key: number]: JsonValue;
}
export type JsonValue = JsonPrimitive | JsonObject | JsonArray;
export declare function jsonToString(o: any): string;
interface JsonValues {
values: any[];
arrays: number[];
}
/**
* support cyclic reference in json;
* also support array with non-positive integer key, e.g. xs[-1.1]
* */
export declare function jsonToValues(value: any): JsonValues;
export declare function valuesToJson(jsonValues: JsonValues): any;
export declare function jsonToValuesString(value: any): string;
export declare function valuesStringToJson(json: string): any;
export {};