Diysb Tools

JSON से बचें

JSON स्ट्रिंग्स में विशेष वर्णों को एस्केप करें। सुरक्षित संचरण या संग्रहण के लिए JSON डेटा को उचित रूप से एस्केप किए गए प्रारूप में परिवर्तित करें।

JSON टूल्स
JSON इनपुट
एस्केप किया गया JSON आउटपुट
टूल विकल्प
आउटपुट में कोट्स
पूरे एस्केप किए गए JSON आउटपुट को डबल कोट्स में लपेटें।
JSON से बचें उदाहरण

Escape a Simple JSON Object

In this example, we escape all quotes (") around the keys and values in a simple JSON object. This ensures that the JSON data is interpreted correctly if it's used in another JSON object or assigned to a variable as a string.

{"country": "Spain", "capital": "Madrid"}
{"country": "Spain", "capital": "Madrid"}
{{\"country\": \"Spain\", \"capital\": \"Madrid\"}
{{\"country\": \"Spain\", \"capital\": \"Madrid\"}
आउटपुट में कोट्स
पूरे एस्केप किए गए JSON आउटपुट को डबल कोट्स में लपेटें।

Escape a Complex JSON Object

In this example, we escape a more complex JSON object with nested elements containing data about the Margherita pizza recipe. We escape all quotes within the object as well as convert all line breaks into special "\n" characters. Additionally, we wrap the entire output in double quotes by enabling the "Wrap Output in Quotes" option.

{ "name": "Pizza Margherita", "ingredients": [ "tomato sauce", "mozzarella cheese", "fresh basil" ], "price": 12.50, "vegetarian": true }
{ "name": "Pizza Margherita", "ingredients": [ "tomato sauce", "mozzarella cheese", "fresh basil" ], "price": 12.50, "vegetarian": true }
"{\n \"name\": \"Pizza Margherita\",\n \"ingredients\": [\n\"tomato sauce\",\n \"mozzarella cheese\",\n \"fresh basil\"\n ],\n \"price\": 12.50,\n \"vegetarian\": true\n}"
"{\n \"name\": \"Pizza Margherita\",\n \"ingredients\": [\n\"tomato sauce\",\n \"mozzarella cheese\",\n \"fresh basil\"\n ],\n \"price\": 12.50,\n \"vegetarian\": true\n}"
आउटपुट में कोट्स
पूरे एस्केप किए गए JSON आउटपुट को डबल कोट्स में लपेटें।

Escape a JSON Array of Numbers

This example showcases that escaping isn't necessary for JSON arrays containing only numbers. Since numbers themselves don't hold special meaning in JSON, the tool doesn't modify the input and the output remains the same as the original JSON array.

[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
[1, 2, 3]
आउटपुट में कोट्स
पूरे एस्केप किए गए JSON आउटपुट को डबल कोट्स में लपेटें।