Response.json not showing fields with value undefined
<p>Response.json not showing fields with value <code>undefined</code></p>

<p>I'm implementing a node api to manipulate data in a Mongo database. Queries are giving me the right <code>JSON</code>. When I send that <code>JSON</code> to a React client, fields that contain <code>undefined</code> are not showing up. What am I doing wrong? Is there a work-around?</p>

<p>To narrow the scope of my problem, add the code below to a node server. The <code>console.log</code> will print the right output. It will for example include <code>status: undefined</code>, however, the <code>res.json</code> will not include any nodes with a value <code>undefined</code>.</p>

<pre><code>app.get("/test", function(req, res) {
    let test = {
        document: "test",
        data: {
            products: [
                {
                    id: 123,
                    type: "smartphone",
            name: "Motorola Moto G",
                    instock: true,
                    status: undefined,
                    link: null
                },
                {
                    id: 456,
                    type: "notsosmartphone",
            name: "Samsung S7",
                    instock: false,
                    status: "burning",
                    link: undefined
                }
            ],
            length: 2,
            date_created: '20161015T09:15',
            status: undefined,
            person: {name: "Kathy", age: 30, cute: true},
            arr:[123,"abc",{"a":"1"},{"b":"2"},{"c":"3"}]
        }
    };
    console.log(test);
    res.json(test);
});
</code></pre>