Hi guys, I just don't seem to get this right at the moment...say I want to create an array of objects, I'd do it this way of course:
arrayOfWords[
{
"SearchTerm":"mySearchTerm1",
"Syn":"synonym1",
"Syn":"synonym2",
"Syn":"synonym3"
},
{
"SearchTerm":"mySearchTerm2",
"Syn":"synonym1",
"Syn":"synonym2",
"Syn":"synonym3"
}
]
That's all OK but I'm now in a situation where I need to loop through that object, check that the SearchTerm matches the value of another variable declared and set elsewhere and if so I need to loop through the synonyms, so this structure isn't too good because all the elements (SearchTerms and Syn) are on the "same" level: I need to know how many synonyms I have in the array so that I can easily loop through them, so I thought that it might be a good idea to have the synonyms as objects themselves, but I'm having some problems with the syntax, how would I define an array of objects of objects? WOuld it be something like this:
arrayOfWords[
{
"SearchTerm":"mySearchTerm1"
{
"Syn":"synonym1",
"Syn":"synonym2",
"Syn":"synonym3"
},
"SearchTerm":"mySearchTerm2",
{
"Syn":"synonym1",
"Syn":"synonym2",
"Syn":"synonym3"
}
}
]
So that each SearchTerm has a number of synonyms?
thanks