TypeError: this._arrayOfTopLevelItems is undefined

You may find this Dojo error when you are trying to create a JSON store object from a JSON string as follows:

var store = new dojo.data.ItemFileWriteStore({
	data: jsonString
});		

To resolve this issue, all what you should do is to convert the json string to a json object by using the dojo.fromJson as follows:

var store = new dojo.data.ItemFileWriteStore({
	data: dojo.fromJson(jsonString)
});