"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toEscapedJSON = toEscapedJSON;
exports.fromEscapedJSON = fromEscapedJSON;

function toEscapedJSON(obj) {
  const characters = {
    '[': '&lsqb;',
    ']': '&rsqb;',
    '"': '&quot;'
  };
  return JSON.stringify(obj).replace(/\[\]"/g, x => characters[x]);
}

function fromEscapedJSON(str) {
  const patterns = {
    '&lsqb;': '[',
    '&rsqb;': ']',
    '&quot;': '"'
  };
  return JSON.parse(str.replace(/&quot;|&rsqb;|&lsqb;/g, x => patterns[x]));
}
//# sourceMappingURL=utils.js.map