How can I transform a JavaScript object into an array of objects, each containing a key and value pair?
For example:
var data = { firstName: 'John', lastName: 'Doe', email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="86ece9eee8a8e2e9e3c6e1ebe7efeaa8e5e9eb">[email protected]</a>' }
The desired output would look like this:
[
{ key: 'firstName', value: 'John' },
{ key: 'lastName', value: 'Doe' },
{ key: 'email', value: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="53393c3b3d7d373c3613343e323a3f7d303c3e">[email protected]</a>' }
]