title: How to replace/update a key value inside a json array in golang?
body: <p>I have a json array where it contains some flags as key and I have set the default values for those keys as false. this is my json array.</p>
  
  <pre><code>var flags = map[string]bool{
      "terminationFlag":  false,
      "transferFlag":   false,
      "jrCancelledFlag": false,
      "jrFilledFlag":  false,
  }
  </code></pre>
  
  <p>On performing an operation in a for loop, i have to update 1 field in the above json array as true. During the next iteration, it has to update the 2nd field in the json array as true. After all the fields in the json array is set to true, I have to return the json array.</p>
  
  <p>the code i tried:</p>
  
  <pre><code>  Keystrings := []string{"terminationReport - 2019-1","transferReport - 2019-1","jrCancelledReport - 2019-1","jrFilledReport - 2019-1"}
    fmt.Println("Keystrings ", Keystrings)
  
    for i,value := range Keystrings {     
      bytesread, err = stub.GetState(value)
      var result []string
      _ = json.Unmarshal(bytesread, &amp;result)
      fmt.Println("result ", result)
      if result[0] == "yes"{
          fmt.Println("result in if ", result)
         flags[i] = true
      }
  }
  </code></pre>