I have a very simple json file
{
"property" : "value"
}
The value in my application is quite long and Visual Studio forces me to write on a single line. If I try to line break like this for my mere human eyes:
{
"property" : "value value value
value value"
}
I get an error as the string is not continued on the second line. I cannot seem to use the + operator either.
Does anyone have a suggestion? Thanks.
In Visual Studio, separating a string literal onto two lines as an end-of-line character to the end of the first line. Since "control" characters must be escaped in JSON, simply add a "\" to escape the EOL and JavaScript will ignore that character. For example:
{
"property": "This is some text I want broken \(hit enter)
into two lines"
}
should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With