I'm planning to utilize JSON for stringifying the value of a property within an object, which will then be stored as a Tag on Google Calendar using Google Apps Script. The value in question is actually a double-nested Object
(look at extraAttributes
within myObject
).
The structure of my object looks like this:
var myObject = {
"location": "somwehere",
"date": new Date(),
"numSomething": 20,
"extraAttributes": {"used": true, "interval": 60, "internals": {"timer": 10, "visible": false} }
}
I've tried to organize it neatly and make it readable... however, myObject typically includes between 20-40 properties, some of which are nested Objects
. This leads to the following question:
Is there a way to determine if the value of a property in an Object is also an object itself (considering additional levels of nesting)? I am concerned about how JSON.stringify
and JSON.parse
may impact other data (I have only tested it on the particular Object type and it worked fine) and whether these functions would affect script performance when dealing with 20-40 properties.
I am considering checking if the value is an Object before stringification (would this approach be inefficient?). Please provide insights on Objects and nesting, especially if they may pose significant challenges in the future ;)