In the JSON → String direction the input is parsed first, so invalid JSON stops with its line and column instead of being escaped into a broken literal. It is then minified, with numbers and key order kept exactly as written, where JSON.parse would round an integer past 2^53 and move a key such as "1" ahead of "b". Last comes the escaping, which happens twice over: JSON’s own escapes, such as \" and \n, stay in the text, and the target language’s escaping goes on top, so every one of those backslashes is doubled. For a JSON string the result is exactly what JSON.stringify gives for the minified text. Unlike the text escape tool, which escapes any text, this one only accepts JSON, keeps it valid, and knows the traps of each place the literal is going.
For JavaScript, single quotes are the default because JSON is full of double quotes; backticks keep line breaks when formatting is kept, and ${ is escaped. U+2028 and U+2029 are escaped because a string literal could not contain them before ES2019, and "<" is written as \x3C before !--, script and /script, as the HTML Standard recommends, so the literal is safe inside a script element. Java translates \u escapes before it reads the source, so an undoubled \u000a is a real line break and a compile error. C# regular strings cannot hold U+0085, U+2028 or U+2029, so those are escaped. A .env value is written in single quotes. dotenv and a POSIX shell read everything between them literally, with no way to escape a quote there, while python-dotenv turns \\ into \ and expands ${…} inside them too. So apostrophes, escaped backslashes and dollar signs inside JSON strings become \u0027, \u005c and \u0024, which JSON reads as the same characters. Every target but C# was checked by decoding its output with the real parser.
In the String → JSON direction the input can be a JSON string in double quotes, a single-quoted or backtick literal, a C# verbatim @"…" string, a NAME='…' line from a .env file, which is read literally as dotenv reads it, or a line such as const s = "…"; copied from code. The escapes that JSON, JavaScript, Python, Java and C# share are decoded, and the process repeats while the result is itself a quoted string, so JSON that was stringified twice, as logs and queues often print it, comes out in one step, with the layer count reported. Escaped JSON with its outer quotes already stripped, such as {\"a\":1}, is recognised too. An error carries the line and column in the text you pasted, traced back through every layer, rather than a position in an intermediate string you never saw.