Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongdb json The word object is a problem #85

Open
ali27001 opened this issue Dec 30, 2019 · 3 comments
Open

mongdb json The word object is a problem #85

ali27001 opened this issue Dec 30, 2019 · 3 comments

Comments

@ali27001
Copy link

Invalid JSON.

Error: Parse error on line 3:
[ { "_id" : ObjectId("5e09ad9d52
----------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
example json https://jsoneditoronline.org/?id=bcac623bb8cd401dbdb62f48bd1c3c68

@DrorHarari
Copy link

@ali27001 this is not a valid JSON (see simple syntax diagram at https://www.json.org/json-en.html). What you have here may be a valida JavaScript object value but it is not JSON. The ObjectID(...) is the problem here as the error message makes clear.

@ali27001
Copy link
Author

yes right, but wouldn't it be good to support it?

@DrorHarari
Copy link

Not really - JSON is plain, simple and safe. The moment you include executable code you invite a world of trouble and then it is no longer JSON. Recall that even though JSON stands for Java Script Object Notation, it is a standard of its own and in no way relies on JavaScript. The JavaScript spec includes a JSON compatible object literal notation. The sample you provided in JavaScript, not JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants