JSFiddle - React, Tailwind, and code Playground

by ChrisStanyon

JavaScript

let data = {
  "results": [
    {
      "id": "123",
      "list": [
        {"key": "source",   "value": {"stringtype": "somesite"}}, 
        {"key": "otherkey", "value": {"stringtype": "abc"}}
      ]
    }
  ]
}

let somevariable = data.results[0].list?.find(attr => attr.key === 'source1');

console.log(somevariable)

//somevariable[0].value.stringtype = "Test";

console.log(somevariable.value.stringtype)