So are you suggesting ensuring what's used as a lookup is a int? e.g. paymentMethods[parseInt(billingMethod, 10)] this will still work, though JSON keys are always strings.