JSFiddle - React, Tailwind, and code Playground

JavaScript

function preprocessJSON(str) {
    
    return str.replace(/("(\\.|[^"])*"|'(\\.|[^'])*')|(\w+)\s*:/g, function(all, string, strDouble, strSingle, jsonLabel) {
        if (jsonLabel) {
            return '"' + jsonLabel + '": ';
        }
        return all;
    });
    
}

var json = '{empty: false, ip: true, "mixed": "yes!", test: "{ test: \\\" { test: \\\\\\\"test\\\\\\\" } \\\" } "}';


var json1 = '{  "results": [    {      "success": true,      "result": {        "id": "0e500503e4d740a18a73cb0aa82e256e",        "signature": ""      }    },    {      "success": true,      "result": [        {          "familyId": 93,          "familyType": "Banner",          "familyName": "Great Clips",          "organizationId": 12927851678620,          "parentFamilyId": 92        } } ] }';

	function addQuotes(s, keys) {
        var result = s;

        for () {
        console.log(1 + " " + key);
            var search = new RegExp('"' + keys[key] + '": (\\d+)\\D',"g");
            console.log(2);
            result = result.replace(search,
                function(all, num) {
                console.log(3);
                    if (num) {
                        return all.replace(num, '"' + num + '"');
                    }
                    console.log(4);
                    return all;
                }
            );
            console.log(5);
        }
        console.log(6);
        return result;
    }

console.log (addQuotes(json1, ["familyId","organizationId","parentFamilyId"]));