JSON Format Assertion

According to the course the JSON format Starts with curly braces, the specification being used is not being stated but I am assuming its RFC-8259. Which makes this assertion incorrect, [“hello”], “hello”, { hello: “hello” } are all valid JSON’s. I believe you are making that assertion as it relates to your documents but its framed in a way that is talking about JSON specifications. Am I missing something here? Thoughts?

Hi @Zachary_Hutchins, welcome to the community.
Thank you for pointing this out, I will forward this feedback to the appropriate team.

Also, please note that the mongo shell accepts a more relaxed version of JSON for developer convenience, including unquoted key values and shell helpers like ISODate() . MongoDB tools & drivers generally use Extended JSON which is compliant with the JSON RFC and adds additional type information for MongoDB’s BSON data types: https://docs.mongodb.com/manual/reference/mongodb-extended-json/.

For example { hello: "hello" } is not valid because all keys and values must be quoted. The mongo shell is fine with this (as are some other tools), but a parser/library expecting valid JSON will fail.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

2 Likes