break lines in JSON String
See original GitHub issueI’m struggling to break lines within the string in my JSON language file.
This is what I already tried, which doesn’t break a new line:
line: "This is a line. \n This is another line. \n Yet another line",
line: ("This is a line."+ <br/> + "This is another line. \n Yet another line"),
line: ('This is a line. <br/> This is another line. \n Yet another line'),
I obviously try to make a new line after each sentence. This is how I call it:
<TooltipLink onClick={() => {
this.toggleHelpTextDialog(t('test:test.line'));
}}/>
Any ideas? Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Are multi-line strings allowed in JSON? - Stack Overflow
JSON does not allow real line-breaks. You need to replace all the line breaks with \n . eg: "first line second line". can...
Read more >How to use a line break in JSON? - Hardique Dasore - Medium
As we can't add <br/> tag in JSON, we need to use \n (newline) before the start of the next paragraph or bullet...
Read more >Is there a way to add a simple line break to the Text field of a ...
You can use a <br> tag where you want the line break. You would just need to make sure wherever this code is...
Read more >Escaping new line character in JSON to avoid data loading ...
JSON strings do not allow real newlines in its data; it can only have escaped newlines. Solution.
Read more >How can I add \n(newline) In Json string - Python Help
If you need to have a newline inside a string inside JSON you can use the two literal characters \n which means you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You can’t do that in react - not without doing some dangerously insert html: https://zhenyong.github.io/react/tips/dangerously-set-inner-html.html
but what you can do:
alternative to above solution -> use markdown
https://github.com/acdlite/react-remarkable