Cookies This site keeps only what it needs to work. There is no analytics and no advertising on it today, and nothing here follows you to other sites. Read the privacy policy

Choose what to allow
+92 312 8299940Free Quote
EN – Language: English
Free tool, nothing to install

JSON Stringify Online
Escape, Encode And Undo

The JSON stringify online tool converts JSON into a safe string, then converts the same string back into JSON. Also, the tool gives functions to escape, URL encode, and Base64 encode. All of these conversion processes occur within the single browser tab.

  • FreePrice
  • 10Conversions
  • NoneSign-up
  • NoneUploads

JSON Stringify and Escape

Stringify, escape, URL-encode or Base64 your JSON, and undo each one

Turns any text, usually JSON, into one escaped string with quotes around it, the way JSON.stringify() does. Pick a language to get a line you can paste into code.

Input size
0 B
Result size
0 B
Change
0%

Ready. Paste some text or JSON, pick a conversion and the result appears.

Your browser does all of the work here, in this tab. We upload nothing, store nothing and log nothing.
Add a link to this tool on your own site

Copy the code below and drop it into your page. It places a link to this free tool.

Guides for this tool

Articles with worked examples, tables and a short video that help you get more from this tool.

  • JSON CommentsJSON Comments

    JSON comments don't exist in standard JSON. Here's why, plus every workaround: JSONC, JSON5 and comment keys.

    9 minutes of reading · video guide inside

The short version

What This JSON Stringify Tool Does

JSON is often found embedded within other types of data (e.g., strings in your program’s source code, fields in other JSON files, URLs, headers, etc.). At this point, issues arise with quotes and line breaks.

That’s what makes the JSON Stringify online tool so useful. All you need to do is paste in your JSON, select the type of conversion you want to perform on that JSON, and then click on "Reverse It" to convert the converted JSON back to its original state.

This single page gives all of the functionality that would need five separate smaller tools (escape, unescape, URL encoding, query string, Base64).

The rules for this tool are based on the official specification. JSON.stringify specifies how values are converted into text, which this tool does. But this tool offers more flexibility than the native function.

Why not use the browser console? Yes, though a very large file can keep the phone busy for a little while. You open the tools, paste the text and fix the quotes by hand. Also, the console cannot undo a Base64 string or wrap a line for Java. So this page saves you steps.

Stringify And Parse

Stringify turns text into one string literal. The quotes inside get a backslash, and each line break becomes \n. The whole result is wrapped inside a pair of double quotes.

Drawing of JSON text on the left passing through an escape step into a quoted string on the right, with a return arrow below
JSON goes in a string, and comes back out.

On the other hand, parse will do the reverse. If you enter an escaped string into parse, it will return the unescaped portion of the string. Parse also removes the outside quotes from your string, as well as any variable name (for example, String json =) and the trailing semicolon.

At times, some values are being converted into a string multiple times. If you have set "Levels" to 2, then the parse will strip away both levels of strings simultaneously.

Wrap The Result As Code

Most people stringify JSON to paste it into source code. So pick a language under Wrap as code, and you get a full line.

JSON stringify tool with Java chosen as the wrapper, showing a line that starts with String json and holds the escaped JSON
Pick a language and paste the line.

You may select from Java, Python, Go, C#, JavaScript, PHP, and/or Shell. All languages have their own quoting conventions. For example, PHP utilizes single quotes. To use an apostrophe with Shell, a "special trick" must be employed. The tool will accommodate either convention.

Go does not use surrogate pairs when reading an escape. So, if you are using emoji in your text, do not turn on the "non-ASCII" option for Go.

Escape JSON Into A String, Or Unescape It, Right In Your Browser

Escape is the process of converting a JSON object into a string, but removing the enclosing quotation marks. You will use escape if you are placing a JSON object into another string which contains quotes.

JSON stringify tool in parse mode, turning a double-escaped string back into readable formatted JSON
A double-escaped string, read back as JSON.

Unescaping eliminates the backslashes. The combination of a backslash and an n will create an actual line break. The combination of a backslash and a quotation mark will result in a quotation mark. And finally, unicode escapes (a backslash and the letter u followed by four digits) will be converted back to their corresponding letters.

This JSON escape online tool also reads \x41 and \u{1F600}, which other tools skip.

Query Strings And Base64

JSON in a URL? Use percent encoding to make it safe. If you’re submitting data through forms or APIs, turn the object into a query string instead. When there are nested keys, they can be represented with brackets like this: user[name]=Ana

JSON stringify tool turning a web address with bracketed parameters into nested JSON with a list of tags
A URL turns into nested JSON.

It can also turn an escaped string back into plain JSON. Paste a whole URL, and the query becomes JSON. Brackets nest, and a repeated name becomes a list.

Base64 suits headers and tokens. The tool encodes accents and emoji as UTF-8, so they survive. A URL-safe option swaps two characters and drops the padding.

For example, a search page can take its filters as a query string. Then a link carries the filters, and a friend sees the same results. But keep the data flat and short, because many servers cap the length of an address.

Undo The Escaping With A Single Click

Every conversion has an opposite. If you click on "Reverse It," the converted data will go back into the input area so that you can convert it to the other type of conversion. This will allow you to see if the two conversions result in the same JSON.

JSON stringify tool in Base64 mode with the URL-safe option ticked and the encoded result shown beside the JSON
Base64 using the URL-safe option.

Safe By Design

The tool never runs your text as code. Unescaping is a scanner, and parsing uses the same reader as our other JSON tools. Query keys such as __proto__ are refused, so they cannot change how an object behaves.

Video guide

See the JSON Stringify at Work, Start to Finish

This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.

How it works

Using The JSON Stringify Tool, Step By Step

Four simple steps make up all conversions. But depending on which type of conversion you select, your options will vary.

  • Pick a conversion

    Choose which option (stringify, escape, URL, query string or Base64) you want to use. Below each option is a description of its function.

  • Paste your text

    Paste JSON/plain text into this box, or load a file from your computer. As soon as you type, the escaped version of what you have typed will appear below.

  • Set the options

    Minify the JSON first, sort its keys, escape non-ASCII letters, or wrap the result as code.

  • Copy, save or reverse

    You can get the result from the copy button, or save it to a file. Or, click "reverse" to make sure your work was correct.

Why this one

What This JSON Stringify Tool Does Differently

Many tools stringify and stop there. These are the extras.

  • Ten conversions, five pairs

    Stringify, escape, URL, query string and Base64, each with its own undo. You never hunt for the reverse tool.

  • Seven code wrappers

    Prepare a line of code for either JavaScript, Java, C#, Python, Go, PHP or Shell with proper quotes.

  • Peels nested layers

    A string that was stringified two or three times comes back in one step. It also strips a variable name around it.

  • Exact errors

    When you’re dealing with an error in your JSON, this program will show you exactly where the issue lies (line and column) and tell you why it’s broken (bad escape or bad base64).

  • Big numbers stay exact

    An ID with 20 digits keeps all 20 of them. The tool never turns your numbers into rounded guesses.

  • Nothing leaves your tab

    The tokens and customer info will go through here. But since the user’s web browser is doing the processing, all of that info will never reach our server.

Good habits

Habits For Stringifying JSON Safely

A few small habits prevent most escaping bugs.

  • Validate before you stringify. A broken JSON creates a broken string. Inspect it first, and you will find the error when it is most obvious.
  • Minify first to save space. Indentation adds many characters and many \n marks. Turn on the minify switch for a short result.
  • Escape a string a single time, never twice. Double escapes are common bugs. When you find two backslashes in your input string, reparse the string and start over.
  • Use the right wrapper for the language. The same string which works with Java can be problematic with PHP. The wrapper list will select the correct type of quotes for you.
  • Keep non-ASCII letters readable. Modern languages read UTF-8 fine. Turn on the escape switch only when a system cannot handle it.
  • Prefer a query string for simple data. The flat object is a good fit for the query string. The deeper data should be Base64 encoded or submitted in the request body.
  • Never tuck passwords or tokens inside a URL, escaped or not. Addresses get saved in logs and history. Send tokens in a header or a body instead.
  • Test the round trip. Press Reverse it. If you get the same JSON back, the conversion lost nothing.
  • Sort the keys before you compare. Two objects with the same keys in a different order look different as text. Sorting removes that noise.
  • Check the byte size. The size boxes show how much the conversion adds. Base64 adds about a third, and escaping adds a little.
Worth avoiding

Common Stringify And Escape Mistakes

Each of these breaks a request or a config file. The tool highlights those hidden characters so you spot them quickly.

  • Escaping twice

    A string with \" everywhere has been escaped two times. Parse it with Levels set to 2.

  • Forgetting the outer quotes

    Stringify adds quotes, and escape does not. Choose the one that suits where the text is going.

  • Single quotes in JSON

    JSON needs double quotes. Single quotes work in code, but a JSON parser rejects them.

  • Base64 without UTF-8

    Plain Base64 fails on accents and emoji. This tool encodes the UTF-8 bytes first, so it never fails there.

  • Trusting every query key

    Keys such as __proto__ can change how code treats an object. This tool refuses them.

Questions

JSON Stringify Questions People Ask

Is this JSON stringify online tool free?

Yes. You pay nothing, you need no account, and there’s no cap. Since your own browser does the work, there is no server bill for us to hand on to you.

Is my JSON sent off my device?

No. Each escape and unescape step runs inside your own browser. Nothing reaches this site, and we keep nothing. Close the tab, and every string you entered is wiped from memory.

What does stringify do?

It turns text into a single string literal. Quotes get backslashes, line breaks become <code>\n</code>, and the result sits in double quotes.

How do I turn a stringified value back into JSON?

Choose Parse a string to JSON and paste it. The tool strips the quotes and the backslashes, then formats the JSON if you like.

How do escaping and stringifying differ?

Stringify adds the outer double quotes. Escape does not. Use escape when the string already has quotes around it in your code.

What is the Levels option for?

It repeats the conversion. Level 2 stringifies a string that is already stringified. On the way back, it peels each layer.

Can I paste a line of code, such as String json = "...";?

Yes. Parse mode removes the variable name, the quotes and the semicolon, then undoes the escapes.

Can it handle emoji and accented letters?

Yes. Text stays as it is unless you turn on the non-ASCII switch. Then it writes each character as a <code>\u</code> escape, with pairs for emoji.

How does JSON to query string work?

Each value becomes a name and a value. Nested objects use brackets, so <code>{"a":{"b":1}}</code> becomes <code>a[b]=1</code>. Lists get numbers, or repeat the name if you turn numbering off.

Why does stringify double my backslashes?

Because a backslash is also the escape mark. So each real backslash must be written as two. Then the parser reads the two as one, and parse reverses it.

Will it convert a large file?

Yes. Files up to five megabytes open from disk. However, live conversion stops above two megabytes, so press Convert instead.

Is URL-safe Base64 different?

Slightly. It swaps plus and slash for dash and underscore, and it drops the equals padding. That makes it safe in a URL.

Why does it report that my JSON is invalid?

Some modes read your input as JSON first. If you see the message, fix the line it names. Stringify and escape still work on plain text.

More free tools

Handy Companions For JSON Work

Stringifying is one step. These three tools handle the steps around it.

Ready To Convert Some JSON?

Paste your JSON, pick a conversion, and copy the result. The tool is free, needs no account, and keeps every byte on your device.

Prefer Denwix on GoogleReview Denwix on Google