Open springimport opened 7 years ago
Currently I use the windows 10 x64 OpenServer and I have a problem with slashes in JSON.parse().
JSON.parse()
VM444:1 Uncaught SyntaxError: Unexpected token D in JSON at position 10 at JSON.parse (<anonymous>) at (index):477
Page source:
root = JSON.parse('{"name":"\\D:\\OpenServer\\domains\\opcache-status","children":[{"name":"vendor","children":[{"name":"rlerdorf","children":[{"name":"opcache-status","children":[{"name":"opcache.php","size":54152}]}]}]},{"name":"index.php","size":712}]}');
My solution:
root = JSON.parse('<?php echo json_encode(str_replace('\\', '/', $dataModel->getD3Scripts())); ?>');
Result:
root = JSON.parse('{"name":"\/D:\/OpenServer\/domains\/opcache-status","children":[{"name":"vendor","children":[{"name":"rlerdorf","children":[{"name":"opcache-status","children":[{"name":"opcache.php","size":54464}]}]}]},{"name":"index.php","size":712}]}');
Currently I use the windows 10 x64 OpenServer and I have a problem with slashes in
JSON.parse()
.Page source:
My solution:
Result: