Encode string to JSON



How JSON String Encoding Works

JSON encoding serializes raw text (or PHP print_r() dumps) into a valid JSON literal by escaping double quotes (\"), backslashes (\\), newlines (\n), tabs (\t), and control characters. This ensures multi-line strings or HTML snippets can be embedded safely inside JSON objects, API requests, and config files.

  • PHP print_r() Support: Check String is PHP print_r output to convert legacy PHP debug dumps into structured JSON.
  • Related Tools: Need to decode JSON, unwrap double-escaped JSON logs, or edit trees visually? Try JSON Decode, JSON Unescaper, JSON Editor, or the JSON API & FAQ.
Please read the privacy policy (agreement of the cookies usage, other websites embedded content, etc.). If you continue to use the site, we will assume that you agree with our privacy policy.
OkPrivacy Policy