Looping through object, having object of arrays

Hi Team
I am having an object , which contains array

for example
data : {

“class” : {
“9th” : {
“studentid”: abc,
“name” : “Ramesh”,
“totalclassMonths” : [“Jan 2020”, “Feb 2020”, “March2020”]

      }

},
“10th” : {
“studentid”: abc,
“name” : “Nirav”,
“totalclassMonths” : [“Jan 2020”, “Feb 2020”, “March2020”]

      }

}

}

I want to print table like this . Basically , getting first object, from object print months to form table heading as months will always be same

Class Jan2020 Feb 2020 March 2020
9th Ramesh Ramesh Ramesh
10th Nirav Nirav Nirav
Is this possibl? tried V-for but it loops through elements and print th months twice in single table heading.
Thanks in advance, sorry if this is confusing

If the months will always be the same, I suggest not duplicating the same ‘totalClassMonths’ array in every object. Possibly move the array to the ‘data’ or ‘class’ level if it makes sense in your application.

As far as not printing the heading multiple times, I would add a boolean data property that gets set after you first read the months, then check the boolean value when you go to print the months again. If the boolean is set, then don’t print the months.

data() {
    return {
        headingPrinted: false,
        ...
    }
}

Also, a general formatting suggestion is to indent your code and objects to be more readable for people reading your question:

data : {
    class : {
        9th : {
            studentid: "abc",
            name : “Ramesh”,
            totalclassMonths : [“Jan 2020”, “Feb 2020”, “March2020”]
        },
       10th : {
            studentid: "abc",
            name : “Nirav”,
            totalclassMonths : [“Jan 2020”, “Feb 2020”, “March2020”]
       }
   }
}

and it may have been just a simple mistake, but your data object property names should not be quoted, i.e. studentid, not “studentid”

Thanks will try that but as per suggestion there is no way I can only print once. I mean going to object, then going to first object array and reading it and printing it. Sorry that was a typo mistake in regards to properties.

Without seeing more of your code, I’m not sure what else to suggest.
If the problem persists, I suggest including more of your JavaScript, template, etc. I know the forum has a link to suggestions on how to format questions.

Thanks restructured it . Worked and easy to work