I have two objects such as:
{ Count: 1,
Items:
[ { foo: [Object],
name: [Object],
bar: [Object],
baz: [Object],
qux: [Object] } ] }
and
{ Count: 0, Items: [] }
I need to combine them and return one JSON object. However, when I try this, I get
"[object Object][object Object]"
code:
function returnResponse(obj1, obj2) {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain; charset=UTF-8');
var returnResult = obj1 + obj2
res.send(JSON.stringify(returnResult, undefined, 2));
res.end();
}
How do I get all the objects to appear correctly in the browser?
I think you're looking to return both objects as an array: