Échappement de chaîne JSON
Échappez le texte en JSON valide avec guillemets, sauts de ligne et antislashs.
Données
Astuce : Ctrl + Entrée pour lancer
Réglages enregistrés
L’aide détaillée ci-dessous n’est pour l’instant disponible qu’en anglais.
À propos de cet outil
Putting a paragraph, an HTML snippet or a Windows file path inside JSON breaks the JSON if quotes, backslashes or line breaks are not escaped. This tool wraps your text in double quotes and escapes everything JSON requires, giving a string literal you can paste straight into a configuration file, an API request body or a test fixture.
Mode d’emploi
- Paste the raw text, including any line breaks.
- Run the escaper.
- Copy the result, including its surrounding double quotes.
- Paste it as a value in your JSON, after a key and colon.
Fonctionnement du calcul
The text is passed to JSON.stringify, which escapes ", \, control characters, line feeds (\n), carriage returns (\r) and tabs (\t), and wraps the result in double quotes.
JSON.stringify(text)Exemple détaillé
A support message reads She said "hi", then a new line, then "then left \ back". Escaping it produces "She said \"hi\"\n…", where the inner quotes became \" and the backslash became \\, so the value can sit inside a JSON object without breaking it.
Exemple d’entrée et de résultat
Hello → "Hello"
Limites
- Produces a single string literal, not a full JSON document.
- Does not unescape.
- Up to 100,000 characters.
Dernière mise à jour:
Questions fréquentes
Do I need to escape non-English characters?
No. JSON allows UTF-8 text directly; only quotes, backslashes and control characters must be escaped.
How do I unescape a JSON string?
Paste the full JSON into the JSON formatter, or parse it in your code.
Why are there quotes around the output?
A JSON string literal includes its quotes. Remove them only if your template adds its own.
Dépannage
Backslashes doubled again when I re-ran it.
You escaped already-escaped text. Start from the original raw text.
The JSON still breaks.
Check that you pasted the whole result including both outer quotes.
Line breaks show as \n in my app.
That is the escaped form in JSON; parsing the JSON turns them back into real line breaks.
Confidentialité & Utilisation gratuite
Mes données sont-elles stockées ?
Vos données restent dans cet onglet. Nous ne recevons ni fichiers, ni textes, ni valeurs de calcul.
Cet outil est-il gratuit ?
Oui. Aucune inscription ni paiement requis.
Voir aussi
D’autres outils utiles
Formateur et validateur JSON
Validez, formatez ou réduisez le JSON localement, sans envoi.
Développement et SEOConvertisseur CSV en JSON
Convertissez CSV en JSON avec séparateurs et sauts de ligne entre guillemets.
Développement et SEOConvertisseur JSON en CSV
Convertissez un tableau d’objets en CSV. Les chaînes de type formule reçoivent un préfixe protecteur.
Développement et SEO