Use more generic classes to cast json numbers