Updating hash key value

“endpoint_body[:reportRequests][0][:pageToken]”
here i have hash in this form ,how can i update pageToken key value ?

It’s not an hash, but a 3dimension array. But with the " it is just a string.

But without the listing it is hard to say. Just in case an example of the use of the bracket with an hash,

dictionary = { "one" => "eins", "two" => "zwei", "three" => "drei" }
dictionary["one"] = "uno"
puts dictionary["one"]

If it is a hash, which it could be, it’s probably a lot more complicated structurally than it needs to be. But that aside, you should simply be able to do

endpoint_body[:reportRequests][0][:pageToken] = 'whatever'

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs