Have an alternative to JSON.parse that works on dynamic structures, but statically types the values

You’re shooting yourself in the foot IMO, but you do you.

EDIT: Also there couldn’t be another amount key in the same object as they would conflict not matter how you did this.

EDIT2: You can also just define a [](key : String) method on Object that will return the value of the ivar with the name of key if you really wanted to keep the bracket notation Carcin

EDIT3: That would cause return type to be Union of all types, probably is a way around that.