This is what you want:
var data="{"count" : 1, "stack" : "sometext\\n\\n"}";
You need to escape the \
in your string (turning it into a double-\
), otherwise it will become a newline in the JSON source, not the JSON data.
More Related Contents:
- Convert JSON to array in Javascript
- How to use JSON from instagram API?
- Parsing string as JSON with single quotes?
- No ‘Access-Control-Allow-Origin’ header is present on the requested resource error
- POST data in JSON format
- Javascript how to parse JSON array
- Convert object string to JSON
- Javascript : Send JSON Object with Ajax?
- Why do people put code like “throw 1; ” and “for(;;);” in front of json responses? [duplicate]
- How to stringify inherited objects to JSON?
- How to save the output of a console.log(object) to a file?
- JSON.stringify deep objects
- sending file and json in POST multipart/form-data request with axios
- JSON object undefined in Internet Explorer 8
- Reverse of JSON.stringify?
- How to write data to a JSON file using Javascript
- Jquery getJSON populate select menu question
- Javascript show element on click
- JSON syntax for property names
- Encrypt string in PHP and decrypt in Node.js
- how to change the headers for angularjs $http.jsonp
- How to solve Uncaught RangeError when download large size json
- Make XmlHttpRequest POST using JSON [duplicate]
- Should JSON include null values [closed]
- Parsing JSON containing new line characters [duplicate]
- JSON Parse File Path
- JSON to string variable dump
- How to make javascript fetch synchronous?
- XML parser for JavaScript [closed]
- Recursive tree search in a nested object structure in JavaScript