I am reading the plain text file in node.js
using ajax call from client side.
Result :
success gives the result as below.
""[{\"x\":233,\"y\":279,\"count\":1},{\"x\":256,\"y\":243,\"count\":6}]\n[{\"x\":233,\"y\":279,\"count\":1},{\"x\":256,\"y\":243,\"count\":6}]\n""
After parsing the above result :
JSON.parse(result);
"[{"x":233,"y":279,"count":1},{"x":256,"y":243,"count":6}] [{"x":233,"y":279,"count":1},{"x":256,"y":243,"count":6}] "
I want to change this string to array of objects,
Expected Result is array of objects:
[{"x":233,"y":279,"count":1},{"x":256,"y":243,"count":6},
{"x":233,"y":279,"count":1},{"x":256,"y":243,"count":6}
]
Ajax call Code
$.ajax({
url: document.URL + "getData",
method : "GET",
success: function (result) {
var info = JSON.parse(result);
var object = JSON.parse(info);
console.log(object);
}
});
Any idea will be helpful.