Fixes/Preparation for json deserializer

This is another rip from #260 which fixes a bunch of things. #260 itself needs
to be rebased on this and could then be merged, so please review carefully.
You _could_ use one integer for both maps and arrays...
But this would be a rather aestetical (and thus maybe unnecessary) change.