Stone.js API
    Preparing search index...
    • Escape a JSON string so it is safe to embed inside an inline <script> element.

      The result is still valid JSON: only characters that are dangerous in the HTML/JS host context are replaced by their equivalent \uXXXX escapes.

      Parameters

      • json: string

        A JSON string (typically from JSON.stringify).

      Returns string

      The escaped, embed-safe JSON string.

      escapeSnapshotJson('{"bio":"</script>"}')
      // => '{"bio":"\\u003C/script\\u003E"}'