|
|
|
|
|
by skybrian
426 days ago
|
|
The alternative would be to use a different programming language altogether. In programming languages that have built-in static types, parsing JSON works differently. It’s not possible to lie to the compiler so that a variable declared to be a string actually contains something else. You have to use a parser that will construct the specific type you want. The closest thing to JavaScript would probably be Dart, now that it has sound types [1]. You’re right that it’s a pain in some situations. [1] https://dart.dev/language/type-system |
|