JSFiddle - React, Tailwind, and code Playground

JavaScript

obj = {"total" : "foo", "loc" : "bar"};
tempData = [];
tempLoop = [];
    $.each(obj, function(index, value) {
        tempLoop[index] = value;
        if (index === "loc") {
            tempData.push(tempLoop);
        }
    })
console.log(tempData);