title: How to get parent JSON object based on child value in JS
body: <p>My JSON is as follows:</p>
  
  <pre><code>[ RowDataPacket {
      workflowId: 1,
      stepId: 1,
      workflowTypeId: 4,
      baseFieldId: 3,
      relatedFieldId: 0,
      relatedValue: 'YES',
      nextTrueStepId: 2,
      nextFalseStepId: 4 },
    RowDataPacket {
      workflowId: 1,
      stepId: 2,
      workflowTypeId: 2,
      baseFieldId: 4,
      relatedFieldId: 0,
      relatedValue: '',
      nextTrueStepId: 3,
      nextFalseStepId: 4 },
    RowDataPacket {
      workflowId: 1,
      stepId: 3,
      workflowTypeId: 9,
      baseFieldId: 5,
      relatedFieldId: 0,
      relatedValue: 'SUBMITTED',
      nextTrueStepId: 4,
      nextFalseStepId: 0 },
    RowDataPacket {
      workflowId: 1,
      stepId: 4,
      workflowTypeId: 10,
      baseFieldId: 0,
      relatedFieldId: 0,
      relatedValue: '',
      nextTrueStepId: 0,
      nextFalseStepId: 0 } ]
  </code></pre>
  
  <p>How can I get the parent (e.g arr[parentID]) where child element has a nextTrueStepId = 3 ?</p>
  
  <p>I was using a forEach like this, but it iterates the rows sequentially:</p>
  
  <pre><code> arr.forEach(function(row) {
        nextStep = processFlowRow(row, Id);
       });
  </code></pre>
  
  <p>EDIT: Json now looks like the below, but when I call arr[0] I just get back "[" instead of the row?</p>
  
  <pre><code>[
  {
      "workflowId": 1,
      "stepId": 1,
      "workflowTypeId": 4,
      "baseFieldId": 3,
      "relatedFieldId": 0,
      "relatedValue": "yes",
      "nextTrueStepId": 2,
      "nextFalseStepId": 4
  },
  {
      "workflowId": 1,
      "stepId": 2,
      "workflowTypeId": 2,
      "baseFieldId": 4,
      "relatedFieldId": 0,
      "relatedValue": "",
      "nextTrueStepId": 3,
      "nextFalseStepId": 4
  },
  {
      "workflowId": 1,
      "stepId": 3,
      "workflowTypeId": 9,
      "baseFieldId": 1,
      "relatedFieldId": 0,
      "relatedValue": "SUBMITTED",
      "nextTrueStepId": 4,
      "nextFalseStepId": 0
  }
  </code></pre>
  
  <p>]</p>