create an object/array

Create nested objects and arrays I will create my own jsondata with nested objects and arrays called MyClass

dispatch(create('MyClass', 
{
name: 'Computer',
students: [
    {
        id: 1,
        name: 'Bill Gate',
        companies: [{ cid: 1, name: 'Microsoft', found: 1975 }]
    },
    {
        id: 2,
        name: 'Steve Jobs',
        companies: [{ cid: 2, name: 'Apple', found: 1976 }]
    },
    {
        id: 3,
        name: 'Elon Musk',
        companies: [{ cid: 3, name: 'Tesla', found: 2003, 
        cars: [
        { mid: 1, n: 'Model X' }, 
        { mid: 2, n: 'Model Y' }, 
        { mid: 3, n: 'Model S' }] }, 
        { cid: 4, name: 'Paypal', found: 1999 }],
    },
    {
        id: 4,
        name: 'Mark Zuckerberg',
        companies: [{ cid: 5, name: 'Facebook', found: 2004 }]
    },
]
}));

Last updated