Parse valid JSON got "SyntaxError: Unexpected token ILLEGAL" - javascript
The JSON is validated. But when I parse it with JSON.parse(), $.parseJSON() or eval(). I got
"SyntaxError: Unexpected token ILLEGAL"
Here the JSON: https://pastebin.com/cXMTw9Xu
I can parse it with php using json_decode() so I tried json_encode() then copy the result to parse in javascript. However I still got this error.
To reproduce, try to execute this script in your console on any browser.
JSON.parse('{"id":"mindmaps","options":{"id":"mindmaps","instance":"","name":"","description":"","containerStyle":{"width":"auto","height":"auto"},"viewPort":{"width":50000,"height":50000,"allowDrag":true,"left":3819,"top":4422,"originalWidth":50000,"zoom":{"w":50000,"h":50000,"l":3895,"t":4457,"r":1},"originalHeight":50000},"enabled":true,"showBirdsEye":false,"sizeOfBirdsEye":200,"showMultiSelect":false,"showZoom":false,"showStatus":false,"collaboration":{"allow":false,"showPanel":true,"useLongPolling":false,"jsonp":false,"localizedOnly":false,"userName":"","userProfile":"","userIP":"","sizeOfBirdsEye":200,"hubName":"slateHub","url":"","callbacks":{"onCollaboration":null,"onCollaborationStarted":null,"onCollaborationWired":null,"onUnauthorized":null}},"isPublic":false,"imageFolder":"http:\/\/static.slatebox.com\/cursors\/"},"nodes":[{"options":{"id":"first_node","name":"first_node","text":"\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e01\u0e32\u0e23\u0e14\u0e33\u0e40\u0e19\u0e34\u0e19\u0e01\u0e32\u0e23\/\u0e41\u0e19\u0e27\u0e17\u0e32\u0e07","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":3635.515625,"yPos":4810,"height":74,"width":183.96875,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#ADD8C7-#59a989","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"rectangle","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"49701c9265cc","parentId":"first_node","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"e51346f8ebd7","parentId":"first_node","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"first_node","parentId":"ca6e34182a01","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"first_node","parentId":"56268f01d021","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"first_node","parentId":"8dd3e58e9e08","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"49701c9265cc","name":"first_node","text":"\t\u0e43\u0e2b\u0e49\u0e1c\u0e39\u0e49\u0e1e\u0e34\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e47\u0e19\u0e04\u0e19\u0e40\u0e25\u0e37\u0e2d\u0e01 \n\u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e41\u0e19\u0e1a\u0e43\u0e1a\u0e40\u0e2a\u0e19\u0e2d\u0e23\u0e32\u0e04\u0e32 \u0e41\u0e25\u0e30\u0e23\u0e39\u0e1b \n\u0e41\u0e25\u0e30\u0e21\u0e35\u0e01\u0e32\u0e23\u0e23\u0e31\u0e1a\u0e1b\u0e23\u0e30\u0e01\u0e31\u0e19\u0e44\u0e21\u0e48\u0e19\u0e49\u0e2d\u0e22\u0e01\u0e27\u0e48\u0e32 1 \u0e1b\u0e35","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4001,"yPos":4437,"height":69.21875,"width":234.59375,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}},"showParentArrow":false,"showChildArrow":false,"reattachable":true},"relationships":{"parents":[],"associations":[{"childId":"49701c9265cc","parentId":"first_node","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"e51346f8ebd7","name":"first_node","text":"\u0e43\u0e2b\u0e49\u0e1c\u0e39\u0e49\u0e1e\u0e34\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e47\u0e19\u0e1c\u0e39\u0e49\u0e21\u0e32\u0e02\u0e2d\u0e40\u0e2d\u0e07 \n(\u0e22\u0e01\u0e40\u0e27\u0e49\u0e19\u0e19\u0e2d\u0e19\u0e40\u0e15\u0e35\u0e22\u0e07)","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":3999,"yPos":4514.9921875,"height":62.609375,"width":239.375,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"e51346f8ebd7","parentId":"first_node","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"e51346f8ebd7","parentId":"194a2c2bc36f","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"e51346f8ebd7","parentId":"cff7f9a59c1c","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"194a2c2bc36f","name":"first_node","text":"\t\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e14\u0e39\u0e27\u0e48\u0e32\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e2d\u0e34\u0e2a\u0e23\u0e30\u0e43\u0e19\u0e01\u0e32\u0e23\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e40\u0e2d\u0e07\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4298.375,"yPos":4476.9921875,"height":67.609375,"width":231.375,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"e51346f8ebd7","parentId":"194a2c2bc36f","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"cff7f9a59c1c","name":"first_node","text":"\t\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e14\u0e39\u0e27\u0e48\u0e32\u0e02\u0e2d\u0e40\u0e2d\u0e07\u0e08\u0e23\u0e34\u0e07\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4302.75,"yPos":4546.9921875,"height":66.609375,"width":228.375,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"e51346f8ebd7","parentId":"cff7f9a59c1c","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"ca6e34182a01","name":"first_node","text":"\u0e21\u0e35\u0e19\u0e31\u0e01\u0e01\u0e32\u0e22\u0e20\u0e32\u0e1e\u0e08\u0e32\u0e01\u0e42\u0e23\u0e07\u0e1e\u0e22\u0e32\u0e1a\u0e32\u0e25\u0e1e\u0e23\u0e30\u0e21\u0e07\u0e01\u0e38\u0e0e \n\u0e0a\u0e48\u0e27\u0e22\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e04\u0e27\u0e32\u0e21\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e2a\u0e21","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4002.46875,"yPos":4657.5,"height":61,"width":245.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"first_node","parentId":"ca6e34182a01","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"ca6e34182a01","parentId":"ca514c19c067","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"ca6e34182a01","parentId":"9df922474ff8","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"ca514c19c067","name":"first_node","text":"\t\u0e27\u0e34\u0e40\u0e04\u0e23\u0e32\u0e30\u0e2b\u0e4c\u0e2a\u0e20\u0e32\u0e1e\u0e04\u0e27\u0e32\u0e21\u0e1e\u0e34\u0e01\u0e32\u0e23","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4303.5,"yPos":4617.5,"height":62,"width":238.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"ca6e34182a01","parentId":"ca514c19c067","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"9df922474ff8","name":"first_node","text":"\t\u0e14\u0e39\u0e04\u0e27\u0e32\u0e21\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e2a\u0e21\u0e02\u0e2d\u0e07\u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c\u0e17\u0e35\u0e48\u0e04\u0e27\u0e23\u0e43\u0e0a\u0e49","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4308.53125,"yPos":4694.5,"height":65,"width":242.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"ca6e34182a01","parentId":"9df922474ff8","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"56268f01d021","name":"first_node","text":"\u0e04\u0e13\u0e30\u0e01\u0e23\u0e23\u0e21\u0e01\u0e32\u0e23","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4013.5625,"yPos":4911.5,"height":64,"width":238.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"first_node","parentId":"56268f01d021","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"56268f01d021","parentId":"50e87752c77e","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"56268f01d021","parentId":"1af5c25a2616","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"56268f01d021","parentId":"26e6b42303bd","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"56268f01d021","parentId":"616e1d6aba5a","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"50e87752c77e","name":"first_node","text":"\t\u0e08\u0e30\u0e1e\u0e34\u0e08\u0e32\u0e23\u0e13\u0e32\u0e40\u0e1e\u0e14\u0e32\u0e19\u0e23\u0e32\u0e04\u0e32\u0e43\u0e19\u0e15\u0e25\u0e32\u0e14 \n\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e21\u0e35\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e23\u0e32\u0e04\u0e32\u0e01\u0e25\u0e32\u0e07","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4313.375,"yPos":4766.5,"height":67,"width":244.4375,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"56268f01d021","parentId":"50e87752c77e","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"1af5c25a2616","name":"first_node","text":"\t\u0e41\u0e1a\u0e48\u0e07\u0e40\u0e1b\u0e47\u0e19 2 \u0e01\u0e25\u0e38\u0e48\u0e21","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4311.40625,"yPos":4838.5,"height":67,"width":239.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"56268f01d021","parentId":"1af5c25a2616","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"1af5c25a2616","parentId":"189e023daafc","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"1af5c25a2616","parentId":"c6d478066d47","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"189e023daafc","name":"first_node","text":"\u0e01\u0e25\u0e38\u0e48\u0e21\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e21\u0e35\u0e1b\u0e31\u0e0d\u0e2b\u0e32 \u0e0a\u0e31\u0e14\u0e40\u0e08\u0e19","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4574.4375,"yPos":4786.5,"height":72,"width":190.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"1af5c25a2616","parentId":"189e023daafc","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"c6d478066d47","name":"first_node","text":"\u0e01\u0e25\u0e38\u0e48\u0e21\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35\u0e01\u0e32\u0e23\u0e1e\u0e34\u0e08\u0e32\u0e23\u0e13\u0e32","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4572.46875,"yPos":4898.5,"height":76,"width":181.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"1af5c25a2616","parentId":"c6d478066d47","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"c6d478066d47","parentId":"cd0f3786b7fe","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"c6d478066d47","parentId":"fedcba0e0c21","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"cd0f3786b7fe","name":"first_node","text":"\u0e01\u0e25\u0e38\u0e48\u0e21\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e0a\u0e31\u0e14\u0e40\u0e08\u0e19\n\u0e43\u0e19\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e04\u0e27\u0e32\u0e21\u0e1e\u0e34\u0e01\u0e32\u0e23","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4819.5,"yPos":4847.5,"height":78,"width":201.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"c6d478066d47","parentId":"cd0f3786b7fe","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"fedcba0e0c21","name":"first_node","text":"\t\u0e01\u0e25\u0e38\u0e48\u0e21\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e40\u0e2b\u0e21\u0e32\u0e30\u0e2a\u0e21\u0e02\u0e2d\u0e07\u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4817.53125,"yPos":4953.5,"height":82,"width":196.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"c6d478066d47","parentId":"fedcba0e0c21","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"26e6b42303bd","name":"first_node","text":"\t\u0e40\u0e01\u0e13\u0e11\u0e4c\u0e01\u0e32\u0e23\u0e43\u0e2b\u0e49\u0e04\u0e30\u0e41\u0e19\u0e19","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4310.59375,"yPos":5041.5,"height":64,"width":238.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"56268f01d021","parentId":"26e6b42303bd","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"26e6b42303bd","parentId":"fe305f32d96a","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false},{"childId":"26e6b42303bd","parentId":"c7d3cbe98b17","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"fe305f32d96a","name":"first_node","text":"\u0e17\u0e33\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23\u0e44\u0e21\u0e48\u0e43\u0e2b\u0e49\u0e15\u0e49\u0e2d\u0e07\u0e1e\u0e36\u0e48\u0e07\u0e04\u0e27\u0e32\u0e21\u0e23\u0e39\u0e49\u0e2a\u0e36\u0e01 \n(\u0e2d\u0e30\u0e44\u0e23\u0e17\u0e35\u0e48\u0e1c\u0e25\u0e15\u0e48\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e1e\u0e34\u0e01\u0e32\u0e23 \u0e17\u0e35\u0e48\u0e08\u0e33\u0e40\u0e1b\u0e47\u0e19\u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35\u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c)","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4601.75,"yPos":5000.5,"height":78,"width":260.625,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"26e6b42303bd","parentId":"fe305f32d96a","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"c7d3cbe98b17","name":"first_node","text":"\u0e40\u0e23\u0e34\u0e48\u0e21\u0e2a\u0e48\u0e07\u0e43\u0e2b\u0e49\u0e15\u0e48\u0e32\u0e07\u0e08\u0e31\u0e07\u0e2b\u0e27\u0e31\u0e14\u0e43\u0e0a\u0e49\u0e40\u0e01\u0e13\u0e11\u0e4c\u0e19\u0e35\u0e49\n\u0e43\u0e19\u0e01\u0e32\u0e23\u0e1e\u0e34\u0e08\u0e32\u0e23\u0e13\u0e32\u0e40\u0e2d\u0e07\u0e41\u0e25\u0e49\u0e27 (\u0e43\u0e19\u0e2d\u0e14\u0e35\u0e15\u0e1e\u0e36\u0e48\u0e07\u0e2a\u0e48\u0e27\u0e19\u0e01\u0e25\u0e32\u0e07)","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4603.75,"yPos":5087.5,"height":77,"width":264.0625,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"26e6b42303bd","parentId":"c7d3cbe98b17","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"616e1d6aba5a","name":"first_node","text":"\u0e2d\u0e19\u0e38\u0e21\u0e31\u0e15\u0e34","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4305.59375,"yPos":5129.5,"height":64,"width":238.03125,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"56268f01d021","parentId":"616e1d6aba5a","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}},{"options":{"id":"8dd3e58e9e08","name":"first_node","text":"-\t\u0e15\u0e2d\u0e19\u0e08\u0e48\u0e32\u0e22\u0e40\u0e07\u0e34\u0e19 \u0e08\u0e30\u0e43\u0e2b\u0e49\u0e1e\u0e1a\u0e01\u0e31\u0e19 3 \u0e1d\u0e48\u0e32\u0e22 \n\u0e44\u0e14\u0e49\u0e41\u0e01\u0e48 \u0e01\u0e23\u0e21\u0e2f \u0e1c\u0e39\u0e49\u0e1e\u0e34\u0e01\u0e32\u0e23 \u0e41\u0e25\u0e30\u0e1c\u0e39\u0e49\u0e08\u0e33\u0e2b\u0e19\u0e48\u0e32\u0e22","isPinned":false,"isPinnedExact":false,"pinnedRowCount":5,"image":"","imageTiled":false,"xPos":4020.921875,"yPos":5126.5,"height":86,"width":244.40625,"borderWidth":2,"lineColor":"red","lineWidth":2,"lineOpacity":1,"allowDrag":true,"allowMenu":true,"allowContext":true,"backgroundColor":"90-#1693A5-#23aad6","foregroundColor":"#000","fontSize":13,"fontFamily":"Trebuchet MS","fontStyle":"normal","vectorPath":"ellipse","rotationAngle":0,"link":{"show":false,"type":"","data":"","thumbnail":{"width":175,"height":175}}},"relationships":{"parents":[],"associations":[{"childId":"first_node","parentId":"8dd3e58e9e08","isStraightLine":false,"lineColor":"red","lineOpacity":1,"lineWidth":2,"showParentArrow":false,"showChildArrow":false}]}}]}');
Solved
I just found out that if I ajax this JSON using below script. It work like a charm.
But why it does not work with JSON.parse() is still unknown.
$.ajax({
dataType: 'JSON',
method: 'GET',
url: 'path/to/mindmaps.json'
}).success(function(result)){
console.log(result);
}
You are doing everything correctly, you are just missing 1 piece:
JSON.parse and $.parseJSON are expecting strings, not objects. If you were to throw that giant glob into either function, they won't work (you get the stack trace that you see right now.)
If instead, you do the following...
var copyPasteJson = /* your json here */ ;
var parsedResult = JSON.parse(JSON.stringify(copyPasteJson));
Full example here: http://jsfiddle.net/xhx47ghg/
With all that said... you don't need to go through the trouble of converting the copyPasteJson to a string and back to json, you can simply use the object literal, copyPasteJson.
Related
Printed parsed json from escaped json string but can't able to access anything from it on lambda with node 12.x
Here is the code { lambda nodejs 12.x }. console.log("body", event.body); var request = JSON.parse(event.body) console.log("parsed body", request["operation"], request['"operation"'], request.operation, request); result through log. 2021-02-16T13:54:01.357Z 78ca4692-b31d-40b2-bc32-e993a622aaa0 INFO body "{\"operation\":\"getDevice\"} 2021-02-16T13:54:01.357Z 78ca4692-b31d-40b2-bc32-e993a622aaa0 INFO parsed body undefined undefined undefined { "operation": "getDevice" } How to I access data from the object using .key or ["key"] methods ** I am checked this on browser cli it works but not on lambda I don't know what I am done wrong. Please help me.
I am solved this. on the first time on JSON.parse returns normal json string from escaped json. I am passed these json string to another JSON.parse it retured object. someone check this out and report this bug.
AWS Lambda: How do I get property inside event.body, it keep return undefined
I was trying to get event.body.data, but it keep return me undefined, i tried JSON.parse(event), JSON.parse(event.body), JSON.parse(event.body.data), JSON.stringify, almost tried out things that i can do with JSON and non of them seems to work. When i tried JSON.parse(event), will give syntax error. So i suspect it already in JSON object format and when i console.log it, it didn't have the " " quote. If it is already in JSON format, why can't I access the property in it. I also tried wrap it inside if(event.body.data) and it doesn't work as well. Anyone know how to get property inside event.body?
Based on your screenshot it looks like the body data is a JSON string. That means you have to parse it first before you can use it. Something like this: exports.handler = function(event, context, callback) { const body = JSON.parse(event.body) console.log('data: ', body.data) } Then apply the suggestions from #Marcin and fix your JSON data because it's missing quotes.
Your even.body is invalid json string, which explain why JSON.parse fails. Thus, you should check who/what is making the request and modify the code of the client side to invoke your API with a valid json string. It should be: '{"action": "message, "data": "black clolor"}' not "{action: 'message, data: 'black clolor'}"
Thanks #Marcin for the feedback, it was indeed caused by invalid json string sent from frontend. Changing it to the code below solved the issue. {"action": "message", "data": "black clolor"}
Ajax Error : Uncaught SyntaxError: Unexpected token '<' [duplicate]
I am running an AJAX call in my MooTools script, this works fine in Firefox but in Chrome I am getting a Uncaught SyntaxError: Unexpected token : error, I cannot determine why. Commenting out code to determine where the bad code is yields nothing, I am thinking it may be a problem with the JSON being returned. Checking in the console I see the JSON returned is this: {"votes":47,"totalvotes":90} I don't see any problems with it, why would this error occur? vote.each(function(e){ e.set('send', { onRequest : function(){ spinner.show(); }, onComplete : function(){ spinner.hide(); }, onSuccess : function(resp){ var j = JSON.decode(resp); if (!j) return false; var restaurant = e.getParent('.restaurant'); restaurant.getElements('.votes')[0].set('html', j.votes + " vote(s)"); $$('#restaurants .restaurant').pop().set('html', "Total Votes: " + j.totalvotes); buildRestaurantGraphs(); } }); e.addEvent('submit', function(e){ e.stop(); this.send(); }); });
Seeing red errors Uncaught SyntaxError: Unexpected token < in your Chrome developer's console tab is an indication of HTML in the response body. What you're actually seeing is your browser's reaction to the unexpected top line <!DOCTYPE html> from the server.
Just an FYI for people who might have the same problem -- I just had to make my server send back the JSON as application/json and the default jQuery handler worked fine.
This has just happened to me, and the reason was none of the reasons above. I was using the jQuery command getJSON and adding callback=? to use JSONP (as I needed to go cross-domain), and returning the JSON code {"foo":"bar"} and getting the error. This is because I should have included the callback data, something like jQuery17209314005577471107_1335958194322({"foo":"bar"}) Here is the PHP code I used to achieve this, which degrades if JSON (without a callback) is used: $ret['foo'] = "bar"; finish(); function finish() { header("content-type:application/json"); if ($_GET['callback']) { print $_GET['callback']."("; } print json_encode($GLOBALS['ret']); if ($_GET['callback']) { print ")"; } exit; } Hopefully that will help someone in the future.
I have just solved the problem. There was something causing problems with a standard Request call, so this is the code I used instead: vote.each(function(element){ element.addEvent('submit', function(e){ e.stop(); new Request.JSON({ url : e.target.action, onRequest : function(){ spinner.show(); }, onComplete : function(){ spinner.hide(); }, onSuccess : function(resp){ var j = resp; if (!j) return false; var restaurant = element.getParent('.restaurant'); restaurant.getElements('.votes')[0].set('html', j.votes + " vote(s)"); $$('#restaurants .restaurant').pop().set('html', "Total Votes: " + j.totalvotes); buildRestaurantGraphs(); } }).send(this); }); }); If anyone knows why the standard Request object was giving me problems I would love to know.
I thought I'd add my issue and resolution to the list. I was getting: Uncaught SyntaxError: Unexpected token < and the error was pointing to this line in my ajax success statement: var total = $.parseJSON(response); I later found that in addition to the json results, there was HTML being sent with the response because I had an error in my PHP. When you get an error in PHP you can set it to warn you with huge orange tables and those tables were what was throwing off the JSON. I found that out by just doing a console.log(response) in order to see what was actually being sent. If it's an issue with the JSON data, just try to see if you can do a console.log or some other statement that will allow you to see what is sent and what is received.
When you request your JSON file, server returns JavaScript Content-Type header (text/javascript) instead of JSON (application/json). According to MooTools docs: Responses with javascript content-type will be evaluated automatically. In result MooTools tries to evaluate your JSON as JavaScript, and when you try to evaluate such JSON: {"votes":47,"totalvotes":90} as JavaScript, parser treats { and } as a block scope instead of object notation. It is the same as evaluating following "code": "votes":47,"totalvotes":90 As you can see, : is totally unexpected there. The solution is to set correct Content-Type header for the JSON file. If you save it with .json extension, your server should do it by itself.
It sounds like your response is being evaluated somehow. This gives the same error in Chrome: var resp = '{"votes":47,"totalvotes":90}'; eval(resp); This is due to the braces '{...}' being interpreted by javascript as a code block and not an object literal as one might expect. I would look at the JSON.decode() function and see if there is an eval in there. Similar issue here: Eval() = Unexpected token : error
This happened to me today as well. I was using EF and returning an Entity in response to an AJAX call. The virtual properties on my entity was causing a cyclical dependency error that was not being detected on the server. By adding the [ScriptIgnore] attribute on the virtual properties, the problem was fixed. Instead of using the ScriptIgnore attribute, it would probably be better to just return a DTO.
If nothing makes sense, this error can also be caused by PHP Error that is embedded inside html/javascript, such as the one below <br /> <b>Deprecated</b>: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in <b>C:\Projects\rwp\demo\en\super\ge.php</b> on line <b>54</b><br /> var zNodes =[{ id:1, pId:0, name:"ACE", url: "/ace1.php", target:"_self", open:true} Not the <br /> etc in the code that are inserted into html by PHP is causing the error. To fix this kind of error (suppress warning), used this code in the start error_reporting(E_ERROR | E_PARSE); To view, right click on page, "view source" and then examine complete html to spot this error.
"Uncaught SyntaxError: Unexpected token" error appearance when your data return wrong json format, in some case, you don't know you got wrong json format. please check it with alert(); function onSuccess : function(resp){ alert(resp); } your message received should be: {"firstName":"John", "lastName":"Doe"} and then you can use code below onSuccess : function(resp){ var j = JSON.decode(resp); // but in my case i'm using: JSON.parse(resp); } with out error "Uncaught SyntaxError: Unexpected token" but if you get wrong json format ex: ...{"firstName":"John", "lastName":"Doe"} or Undefined variable: errCapt in .... on line<b>65</b><br/>{"firstName":"John", "lastName":"Doe"} so that you got wrong json format, please fix it before you JSON.decode or JSON.parse
This happened to because I have a rule setup in my express server to route any 404 back to /# plus whatever the original request was. Allowing the angular router/js to handle the request. If there's no js route to handle that path, a request to /#/whatever is made to the server, which is just a request for /, the entire webpage. So for example if I wanted to make a request for /correct/somejsfile.js but I miss typed it to /wrong/somejsfile.js the request is made to the server. That location/file does not exist, so the server responds with a 302 location: /#/wrong/somejsfile.js. The browser happily follows the redirect and the entire webpage is returned. The browser parses the page as js and you get Uncaught SyntaxError: Unexpected token < So to help find the offending path/request look for 302 requests. Hope that helps someone.
I had the same problem and it turned out that the Json returned from the server wasn't valid Json-P. If you don't use the call as a crossdomain call use regular Json.
My mistake was forgetting single/double quotation around url in javascript: so wrong code was: window.location = https://google.com; and correct code: window.location = "https://google.com";
In my case putting / at the beginning of the src of scripts or href of stylesheets solved the issue.
I got this error because I was missing the type attribute in script tag. Initially I was using but when I added the type attribute inside the script tag then my issue is resolved
I got a "SyntaxError: Unexpected token I" when I used jQuery.getJSON() to try to de-serialize a floating point value of Infinity, encoded as INF, which is illegal in JSON.
In my case i ran into the same error, while running spring mvc application due to wrong mapping in my mvc controller #RequestMapping(name="/private/updatestatus") i changed the above mapping to #RequestMapping("/private/updatestatus") or #RequestMapping(value="/private/updatestatus",method = RequestMethod.GET)
For me the light bulb went on when I viewed the source to the page inside the Chrome browser. I had an extra bracket in an if statement. You'll immediately see the red circle with a cross in it on the failing line. It's a rather unhelpful error message, because the the Uncaught Syntax Error: Unexpected token makes no reference to a line number when it first appears in the console of Chrome.
I did Wrong in this `var fs = require('fs'); var fs.writeFileSync(file, configJSON);` Already I intialized the fs variable.But again i put var in the second line.This one also gives that kind of error...
For those experiencing this in AngularJs 1.4.6 or similar, my problem was with angular not finding my template because the file at the templateUrl (path) I provided couldn't be found. I just had to provide a reachable path and the problem went away.
In my case it was a mistaken url (not existing), so maybe your 'send' in second line should be other...
This error might also mean a missing colon or : in your code.
Facing JS issues repetitively I am working on a Ckeditor apply on my xblock package. please suggest to me if anyone helping me out. Using OpenEdx, Javascript, xblock xblock.js:158 SyntaxError: Unexpected token '=>' at eval (<anonymous>) at Function.globalEval (jquery.js:343) at domManip (jquery.js:5291) at jQuery.fn.init.append (jquery.js:5431) at child.loadResource (xblock.js:236) at applyResource (xblock.js:199) at Object.<anonymous> (xblock.js:202) at fire (jquery.js:3187) at Object.add [as done] (jquery.js:3246) at applyResource (xblock.js:201) "SyntaxError: Unexpected token '=>'\n at eval (<anonymous>)\n at Function.globalEval (http://localhost:18010/static/studio/common/js/vendor/jquery.js:343:5)\n at domManip (http://localhost:18010/static/studio/common/js/vendor/jquery.js:5291:15)\n at jQuery.fn.init.append (http://localhost:18010/static/studio/common/js/vendor/jquery.js:5431:10)\n at child.loadResource (http://localhost:18010/static/studio/bundles/commons.js:5091:27)\n at applyResource (http://localhost:18010/static/studio/bundles/commons.js:5054:36)\n at Object.<anonymous> (http://localhost:18010/static/studio/bundles/commons.js:5057:25)\n at fire (http://localhost:18010/static/studio/common/js/vendor/jquery.js:3187:31)\n at Object.add [as done] (http://localhost:18010/static/studio/common/js/vendor/jquery.js:3246:7)\n at applyResource (http://localhost:18010/static/studio/bundles/commons.js:5056:29)"
Late to the party but my solution was to specify the dataType as json. Alternatively make sure you do not set jsonp: true.
Try this to ignore this issue: Cypress.on('uncaught:exception', (err, runnable) => { return false; });
Uncaught SyntaxError: Unexpected token } Chrome gaved me the error for this sample code: <div class="file-square" onclick="window.location = " ?dir=zzz"> <div class="square-icon"></div> <div class="square-text">zzz</div> </div> and solved it fixing the onclick to be like ... onclick="window.location = '?dir=zzz'" ... But the error has nothing to do with the problem..
how to solve problem getting json object element
I have a json object that i want to use. { "type": "PROVIDER_PAYLOAD", "message": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVkOTQ3OTg4N2RlMGRkMDc4ZjEzM2FmNyIsImVtYWlsIjoiYWxzb25nZHVuc3RhbjJAZ21haWwuY29tIiwicm9sZSI6IkNVU1RPTUVSIiwiaWF0IjoxNTcwMDI3MDA4fQ.FcpoBPmhTSX535bNgE2ezCCWsNFPjEhc87hM4y6WadM" } so when i try to access it using console.log("Postback: " + payload.type) but i get an error of Postback: undefined i have looked over some resources on the web and most of them do it this way and it works but i am not sure why mine is not giving the value for type thanks in advance
Subh is right. You have to parse the JSON into an object before accessing type using payload.type syntax. So, let's say you have the following: let payload = { "type": "PROVIDER_PAYLOAD", "message": "eyJhbGciOiJIUzWadM" } You have to convert it into a JS object using JSON.parse: let payloadObj = JSON.parse(payload); Now, if you do payloadObj.type, you should be fine. console.log(payloadObj.type); // PROVIDER_PAYLOAD It should work fine. UPDATE: ERROR: SyntaxError: Unexpected token a in JSON at position 0 If you are getting this error, try following to Parse the payload. let payloadObj = JSON.parse(JSON.stringify(payload)) It should solve the problem for you.
Result of BsonDocument.ToJson fails when used in JSON.parse
I'm retrieving data from MongoDB and then sending it to client: var bsonDocument = ... retrieve from database ... var dto = new Dto { MyBson = bsonDocument.ToJson() }; On the client I'm trying to parse MyBson property using JSON.parse. I'm getting the following error: SyntaxError: Unexpected token N. I guess this is because one of the properties looks like this: { ..., "SomeIntProp" : NumberLong(70) } JavaScript parser simply doesn't understand Bson data type: NumberLong. How should I convert BsonDocument to JSON so that the output would omit NumberLong?
There is no easy way to solve this, I worked out a solution by writing my own parsing function which understands the MongoDB BSON types and does the conversion. The native JSON.parse only understands the types used by the JavaScript. Here is my version: https://gist.github.com/Hrish2006/8270187 You probably will not need the html snippets in the code.