Good evening! I need to turn an array in which there are numbers, objects and arrays with objects into a string and back to javascript. (no servers, php, etc.) An example of an object in my array:
{ file : "img/pekka.png", x : random(100,900), y : random(100,500), w : 60, h : 60, angle : 0, alpha : 1, visible : true } I tried to do this using JSON.stringify() и JSON.parse() , but gave an error that it could not be parsed. If you do nothing, you get this:
7,10,1,3.3666666666666596,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],0,8,10,1,5.616666666666652,[object Object],[object Object],[object Object],0 I would be very grateful for the help! Issued an error: unexpected token f in JSON at position 1003
JSON.stringifyis exactly what it does, and in principle the only time it gives an error is that there are circular references in the objects - Grundy