Accessing array elements case insensitively

There is some data which I usually access as (it comes from json
originally):
track = data[‘trackId’]

Now sometimes I get ‘Trackid’ and ‘TrackId’ instead of ‘trackId’ so my
question is: how do I make this access to the element case insensitive?

Thanks :slight_smile:

The title is misleading, since you don’t have any array.

Now, as for your problem, you could for example use this:
https://github.com/junegunn/insensitive_hash

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