Function Updated 17 Oct 2026
Object.entries(obj)
Returns an object's own properties as [key, value] pairs, in the same order as Object.keys(). Works for object literals, JSON data from documents, and Docly objects such as request.
See also Object.keys
Parameters
objobjectrequiredThe object to read properties from.
Returns
An array of [key, value] arrays. For null or undefined, null (standard JavaScript throws a TypeError).
Example
Normal JavaScript, running in the browser or on the Docly™ server.
const stock = { apples: 12, pears: 0, plums: 5 };
Object.entries(stock).forEach(entry => {
write(entry[0] + ": " + entry[1] + "\n");
});
/* Expected output:
apples: 12
pears: 0
plums: 5
*/The JavaScript above produces this output:
apples: 12
pears: 0
plums: 5