Refactor JSON deserializer

This PR refactors the JSON deserializer (merges some files).
If you have questions, feel free to ask.

Suggestions and comments welcome.