JSON format error in lecture

JSON root node can be an Array

JSON can start and end with “[]”

Hey @J.M_Wu,

Welcome to the MongoDB Community Forums! :smile:

Yes, JSON can start with square brackets [ ] . But, inside you again need to put curly braces for them to be a valid JSON.


The following is not a valid JSON:

	"name": "xyz",
	"company": "abc"

This is the valid JSON (notice the curly braces after square brackets):

	"name": "xyz",
	"company": "abc"

This is also a valid JSON (which the lecturer also mentions in the course):

	"name": "xyz",
	"company": "abc"

In general, square brackets denote array structures inside a document. You can read more about MongoDB Document structure from the documentation: MongoDB Documents

Hope this helps resolve your confusion around JSON format and MongoDB documents. Please feel free to reach out for anything else as well.



This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.