question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

newline character "\n" dropped when using editor

See original GitHub issue

General information

  • json-editor version: 2.9.0-beta.0

Expected behavior

strings with “\n” in them should retain the “\n” character when loaded in

{
 "description": "hello,\n how are you?"
}

Actual behavior

the new line “\n” is stripped from the string. You can enter it back in, but it is dropped when loaded into the tool

{
 "description": "hello, how are you?"
}

Steps to reproduce the behavior

import the sample json above and it will drop the \n character. if you convert it to a string \n then it save it. Problem is, \n and \n are two different things.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
germanbisurgicommented, Oct 25, 2022

@schmunk42 Texts for description are treated hier.

I found a workaround here

schema: "description": "hello, \r\n how are you?"

css: white-space: break-spaces;

0reactions
schmunk42commented, Oct 27, 2022

Closing as out of scope, feel free to comment/reopen if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Text Editor which shows \r\n? [closed] - Stack Overflow
With Notepad++, you can show end-of-line characters. It shows CR and LF, instead of "\r" and "\n", but it gets the point across....
Read more >
Editing string variable value removes newline characters '\n' in ...
Press enter (without modifying variable value), observe the value have been modified and the newline characters '\n' have been removed.
Read more >
Why does '\r' (and not '\n') work to replace with a newline in 'vim'?
In vim editor, I want to replace a newline character ( \n ) with two new line characters ( \n\n ) using vim...
Read more >
In software source code, why are newline characters inserted ...
For an editor it is just a sequence if strings. Editor only understands newlines inserted using 'enter' key. The reason for this distinguishing...
Read more >
<New Line> character in Smartform - SAP Community
If you are looping and adding text to a symbol, then in the field 'Start' at the top right of the page, select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found