Decoding payload with JavaScript

i need some support in parsing a payload with javascript. Below you see the json body. I need to return only the valuetype "occupants".


I made it to return the "data" array with the following decoder. Now i need the object "occupants" within data. Can someone tell me what I need to adjust in the following code?

function Decoder(request) {

    // Parse JSON into Object
    var payload = JSON.parse(request.body);
    // Load Data from JSON
    var data =;
    var Occupancy = data.occupants;
    //var humidity = data.hum;
    //var battery = data.bat;
    // Forward Data into Device using Serial
    return data;

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum