I have an a JSON response from an API service below
data = [{
id: 'event-1',
title: 'All Day Event',
start: '-01T14:30:00',
end: '-02T14:30:00',
className: "bg-danger",
description: 'Aenean fermentum quam vel sapien rutrum cursus. Vestibulum imperdiet finibus odio, nec tincidunt felis facilisis eu. '
},
{
id: 'event-2',
title: 'kiniko',
start: '-01T14:30:00',
end: '-02T14:30:00',
className: "bg-success",
description: 'Vestibulum imperdiet finibus odio, '
},
.....
];
How can i i convert it to only object or extract the object?
example is below
convertedObject = {
id: 'event-1',
title: 'All Day Event',
start: '-01T14:30:00',
end: '-02T14:30:00',
className: "bg-danger",
description: 'Aenean fermentum quam vel sapien rutrum cursus. Vestibulum imperdiet finibus odio, nec tincidunt felis facilisis eu. '
},
{
id: 'event-2',
title: 'kiniko',
start: '-01T14:30:00',
end: '-02T14:30:00',
className: "bg-success",
description: 'Vestibulum imperdiet finibus odio, '
}
....
;
In the convertedObject variable, the [] array should be gone leaving only the object {}.
Thanks guys!
const object = array[0]