NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

Unicode Escape/Unescape API

POST

Encode and decode Unicode escape sequences without breaking emojis.

Unicode Escape/Unescape converts text into Unicode escape sequences or restores escaped strings back into readable characters. Send any string to get the transformed text and total character count.

Try it — live request, no key required

Request
POSTapi.apiverve.com/v1/unicodeescape
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "action": "escape",
    "original": "Hello World",
    "escaped": "\\u0048\\u0065\\u006C\\u006C\\u006F\\u0020\\u0057\\u006F\\u0072\\u006C\\u0064",
    "character_count": 11,
    "unicode_points": [
      {
        "char": "H",
        "unicode": "\\u0048",
        "codepoint": "U+0048"
      },
      {
        "char": "e",
        "unicode": "\\u0065",
        "codepoint": "U+0065"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "o",
        "unicode": "\\u006F",
        "codepoint": "U+006F"
      },
      {
        "char": " ",
        "unicode": "\\u0020",
        "codepoint": "U+0020"
      },
      {
        "char": "W",
        "unicode": "\\u0057",
        "codepoint": "U+0057"
      },
      {
        "char": "o",
        "unicode": "\\u006F",
        "codepoint": "U+006F"
      },
      {
        "char": "r",
        "unicode": "\\u0072",
        "codepoint": "U+0072"
      },
      {
        "char": "l",
        "unicode": "\\u006C",
        "codepoint": "U+006C"
      },
      {
        "char": "d",
        "unicode": "\\u0064",
        "codepoint": "U+0064"
      }
    ]
  }
}

About the Unicode Escape/Unescape API

A Unicode escape and unescape API for converting text to \uXXXX format and back. Send a string with action set to escape and every character comes back as an escape sequence, ready to paste into JavaScript, JSON, Java or C# source without encoding problems. Send escaped text with action set to unescape and get the readable string back. Emoji and other characters outside the Basic Multilingual Plane are written as surrogate pairs, the form those languages expect.

Developers use it to debug mojibake in logs, to inspect exactly which invisible or look-alike characters a string contains, to build string literals for localisation files, and to clean up escaped text copied out of JSON payloads or stack traces.

On the Free plan the escape action returns the escaped string and a character count. Paid plans add a per-character breakdown listing each character with its escape sequence and its U+ code point, which is the quickest way to spot a zero-width space or a Cyrillic letter hiding in Latin text.

How it works

The escape action walks the input by code point and writes every character, including plain ASCII letters and spaces, as \u followed by four upper-case hex digits. A character above U+FFFF, such as most emoji, is written as its UTF-16 surrogate pair, two \uXXXX sequences in a row, so 😀 becomes \uD83D\uDE00. character_count counts code points, so that emoji counts as one. unicode_points lists each character with char, its escape in unicode (the full pair for astral characters) and its codepoint in U+ form, such as U+1F600.

The unescape action recognises three forms: \uXXXX with exactly four hex digits, the braced \u{1F600} form with one to six digits, and \xXX with two. Anything else, including other backslash escapes like \n, is left as literal text. A braced value above U+10FFFF returns a 400. Surrogate pairs written as two \uXXXX sequences recombine into the original character. The response holds the result in unescaped, and character_count there is the JavaScript string length, which counts an emoji as two.

Any action other than escape is treated as unescape. The unicode_points breakdown is only produced by escape, and it is null on the Free plan.

What people use it for

JSON Processing
Escape Unicode characters in JSON strings for safe transmission and storage
Code Generation
Generate Unicode escape sequences for use in source code, configuration files, or string literals
Data Migration
Convert Unicode characters to escape sequences when migrating between systems with different encoding support
Debugging
View Unicode escape sequences of characters to debug encoding issues and identify problematic characters

Ways to call it

One endpoint, many ways in — REST with JSON, XML, YAML and CSV, plus GraphQL and an MCP interface for AI agents.

JSON
Default REST response
XML
Markup format
YAML
Human-readable
CSV
Tabular export
Beta
GraphQL
Query language
New
MCP
For AI agents

Other ways to use Unicode Escape/Unescape

Same data, same APIVerve account, same credit balance — one key works on all of them.

Questions.

Common questions about the Unicode Escape/Unescape API.

Read the docs →
How far does the Starter plan go for text conversions?
Starter covers 200,000 conversion requests each month for $29.99. Each API call costs 1 credit, which works out to about $0.15 per 1,000 calls or $0.00015 per call. If you are testing, the Free plan gives you 200 calls per month.
Does it support emojis and multi-byte characters?
Yes. It supports all Unicode characters, including emojis, symbols, and non-Latin alphabets. It properly generates and parses surrogate pairs so high-value code points are preserved accurately.
Can it decode escaped strings back into readable text?
Yes. The API works in both directions. You can escape raw text into Unicode escape sequences or unescape strings formatted with slash-u escape codes back into standard characters.
Are character-by-character codepoints included on the Free plan?
No. The detailed codepoints array is a premium feature reserved for paid plans. The Free plan returns the converted escaped or unescaped string along with character counts, while any paid plan unlocks individual character breakdowns, escape strings, and U-notation values.
Will emojis break when converting to four-digit escape sequences?
No. Characters outside the Basic Multilingual Plane are automatically converted into valid surrogate pairs using standard slash-u notation. This ensures your downstream JSON parsers and code generators can read the output without character corruption.

Ready to build with Unicode Escape/Unescape? Start with 200 free credits — one key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs