Show HN: Stringify.org – encode any text as a JavaScript string

stringify.org

3 points by stevekrouse a day ago

Do you ever want to embed a super long string in JavaScript, and find yourself escaping quotes or interpolations by hand?

I find this comes up a lot, particularly when you're doing code generation stuff, because you need to have examples of code for the LLM, and that code often has strings embedded inside it. For example, take a look at the code properties in this JSON array[1].

Introducing stringify.org, the world's only correct-by-definition JavaScript string encoder website. It uses JSON.stringify, which is the only guaranteed method to output a string that is also valid JavaScript. It's in the spec.

[1] - https://www.val.town/v/stevekrouse/cerebras_coder_prompts