Accessing array elements case insensitively


#1

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:


#2

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