This problem definitely exists in C++ or Rust.
The solution in those languages is either to use something like serde validator, garde (for Rust), or go all the way to protobufs... or write your own data validation/parsing by hand.
Rust and C++ don't even have a Javascript deserializer.