<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_utf8_escape_for_json">
  <info>
    <link type="guide" xref="bson_string_t" group="function"/>
  </info>
  <title>bson_utf8_escape_for_json()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[char *
bson_utf8_escape_for_json (const char *utf8,
                           ssize_t     utf8_len);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p><code>utf8</code></p></td><td><p>A UTF-8 encoded string.</p></td></tr>
      <tr><td><p><code>utf8_len</code></p></td><td><p>The length of <code>utf8</code> in bytes or -1 if it is NULL terminated.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>Escapes the string <code>utf8</code> to be placed inside of a JSON string.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A newly allocated string that should be freed with <link xref="bson_free">bson_free()</link>.</p>
  </section>
</page>
