1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/** * Encode a JS object into JSON string. * @param {*} obj the object * @returns string */ export function encode(obj) { return JSON.stringify(obj); } /** * Decode a JSON string into a JS object. * @param {*} json_str the string. * @returns object */ export function decode(json_str) { return JSON.parse(json_str); }