String to JSON Converter
FeedbackConvert escaped JSON string back to formatted JSON
Input String
JSON Output
Usage Instructions
- Paste JSON string in the left input box (can be code-wrapped or pure JSON string)
- Tool will automatically identify and remove common programming language code wrappers
- Automatically handles escape characters (like \", \\, \n, etc.)
- Select output format (formatted or minified)
- If formatted is selected, you can set the indent size
- Converted JSON will automatically display on the right
- Click "Copy" or "Download" to save the result
Supported Input Formats:
- JavaScript/TypeScript:
const jsonStr = "..." - Python:
json_str = """...""" - Java:
String jsonStr = "..." - C#:
string jsonStr = @"..." - Go:
jsonStr := `...` - PHP:
$jsonStr = "..." - Pure JSON String:
"{...}"
Use Cases:
- Extract and format JSON strings from code
- View JSON data embedded in code during debugging
- Convert JSON strings from logs to readable format
- Handle JSON example code from API documentation
- Convert JSON strings in test cases
Auto-handled Escape Characters:
\"→ Double quote\\→ Backslash\n→ Newline\t→ Tab\r→ Carriage return
About String to JSON Converter
Convert JSON strings from code back to properly formatted JSON. Automatically detects and removes code wrappers from multiple programming languages (JavaScript, Python, Java, C#, Go, PHP), handles escape characters (\, ", \n, \t), and outputs clean, readable JSON. Perfect for extracting JSON from logs, debugging code strings, processing API documentation examples, and converting test data. Supports both formatted and minified output with customizable indentation.
Frequently Asked Questions
What is an escaped JSON string?
It is JSON stored inside a string literal, where quotes, backslashes, and line breaks are escaped for use in code or logs.
Can this extract JSON from code snippets?
Yes. The tool is designed to handle common code-style wrappers and escaped characters so you can recover readable JSON.
Why does my string fail to parse as JSON?
The decoded text still needs to be valid JSON. Missing braces, unescaped quotes, or partial log output can prevent parsing.
Try Our Browser Extension
Access essential tools instantly from your browser sidebar. Encode, decode, format, and hash - all without leaving your workflow.