JSFiddle - React, Tailwind, and code Playground

by jfriend00

HTML

<script src="http://files.the-friend-family.com/log.js"></script>

JavaScript

var myData =  {
"00001": {
    "sid": "00001",
    "oid": "00001",
    "name": "operation 0001 service 1",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {
        "00001": {
            "pid": "00001",
            "name": "parameter 00001 operation 0001 service 1",
            "description": "test parameter 000001",
            "type": "something"
        }
    }
},
"00002": {
    "sid": "00002",
    "oid": "00002",
    "name": "operation 0001 service 2",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {}
},
"00003": {
    "sid": "00003",
    "oid": "00003",
    "name": "operation 0001 service 3",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {}
},
"00004": {
    "sid": "00004",
    "oid": "00004",
    "name": "operation 0001 service 4",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {}
},
"00005": {
    "sid": "00005",
    "oid": "00005",
    "name": "operation 0001 service 5",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {}
},
"00006": {
    "sid": "00001",
    "oid": "00006",
    "name": "operation 0001 service 6",
    "description": "test operation 000001",
    "returntype": "something",
    "parameters": {}
}
};

function findMatches(data, prop, val) {
    var item, matches = [];
    for (var obj in data) {
        item = data[obj];
        if (item[prop] === val) {
            matches.push(item);
        }
    }
    return matches;
}

log(findMatches(myData, "sid", "00001"));