I'm currently working on a Javascript project. I need to take specific data from a large json dataset and store it in an array for later use. This is my code so far:
publicationArray = [] = datafile["publications"]
for (p in publicationArray){
var publication = publicationArray[p];
publicationKeywords.push (publication.keywords);
}
As I'm sure most of you can work out, this takes all objects with the ID 'publications' from the main dataset, then loops through them, taking the keywords of each individual object and storing them in publicationKeywords (an array defined earlier in the code). The problem is that the data is stored in the format
[ [keyword1], [keyword2], [keyword3] ]
whereas I need the data in the form
[keyword1, keyword2, keyword3]
I'm very new to Javascript, so I don't really know what I'm doing wrong, or what I should search to help with it. Is what I want possible, and if so, can anyone help me with a solution?