JSON Single Quote Converter

Validates the input as JSON, pretty-prints it, then replaces every structural double quote (around keys and string values) with a single quote, escaping any single quotes found inside string content. The result is intentionally NOT valid JSON, it's a JS-object-literal-flavored string meant for pasting into JS source where single-quoted strings are the house style. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-24

Overview

Introduction

Many JavaScript style guides prefer single-quoted strings, but JSON only allows double quotes, so pasting a JSON sample into JS source often means manually swapping every quote.

This tool does that swap automatically, correctly handling escape sequences so the result stays syntactically sound even with quotes nested inside string content.

What Is JSON Single Quote Converter?

A quote-character converter that first validates and pretty-prints the input as real JSON, then rewrites every structural double quote as a single quote via a character-by-character scan of the pretty-printed text.

It's the double-to-single half of a matched pair with JSON Double Quote Converter, which does the inverse conversion.

How JSON Single Quote Converter Works

The tool parses the input with JSON.parse and re-serializes it with JSON.stringify(parsed, null, 2) to get a canonical pretty-printed form to work from.

It then scans that text character by character: each double-quoted string's content is extracted, any \" escape inside it is un-escaped to a plain ", any bare ' is escaped to \', and the whole string is re-emitted delimited by single quotes instead of double quotes.

When To Use JSON Single Quote Converter

Use it right before pasting a JSON example into JS/TS source code that follows a single-quote string style.

It's also handy for generating single-quoted mock data or test fixtures directly from a JSON sample.

Features

Advantages

  • Correctly escapes embedded single quotes rather than breaking the string on them.
  • Un-escapes now-unnecessary \" sequences so the output stays clean rather than doubly escaped.
  • Validates the input as real JSON first, catching malformed input before any quote conversion happens.

Limitations

  • The output is not valid JSON and will fail JSON.parse; it's meant for pasting into JS/TS source, not for machine consumption as data.
  • It only changes the quote character; it does not unquote object keys the way Change JSON Syntax does.

Examples

Converting to single-quoted syntax

Input

{"name":"Ada's Lab","active":true}

Output

{
  'name': 'Ada\'s Lab',
  'active': true
}

Both the key and the string value switch to single quotes, and the apostrophe inside "Ada's Lab" is escaped so it doesn't end the string early.

Best Practices & Notes

Best Practices

  • Use JSON Double Quote Converter afterward if you ever need to convert the result back to valid JSON.
  • Combine with Change JSON Syntax if you also want identifier keys unquoted, not just switched to single quotes.
  • Double-check output pasted into template strings or regex literals, where quote characters can have other special meaning.

Developer Notes

The converter always re-derives its input from JSON.stringify(parsed, null, 2) rather than operating on the user's raw original text, which guarantees the character scan only ever encounters well-formed, canonically double-quoted strings to convert, so the escape/un-escape logic never has to guess about ambiguous or already-malformed quoting.

JSON Single Quote Converter Use Cases

  • Pasting a JSON API response into JS/TS source as a single-quoted object literal
  • Generating single-quoted mock data or test fixtures from a JSON sample
  • Matching a codebase's single-quote string style when hand-copying JSON examples

Common Mistakes

  • Feeding the single-quoted output back into a JSON parser expecting it to still be valid JSON; it deliberately is not.
  • Forgetting that object keys are also converted to single quotes, not just string values.

Tips

  • If your target style also wants unquoted keys, run Change JSON Syntax first, then this tool, though note Change JSON Syntax already leaves values double-quoted, so run this one last for the final quote-style pass.
  • Use JSON Formatter first if you need a specific indent width before converting quote style.

References

Frequently Asked Questions