Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's basically the same for typed languages. If you want to map JSON to a typed data structure, you need a serialization library to do that.

JavaScript has a very simple built-in json reader/writer that does no type checking and returns some nested dictionaries or arrays. If you want more, you need a library (for example zod). Or you just trust the data to have the right shape.



Java has runtime type definitions, which you can use to automatically type check deserialized objects. With reflection you can write that in ordinary Java.

I imagine C# and other Java-esque languages have something similar. But Typescript deliberately avoids that, and it would be difficult to get it to do so.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: