added type ensuring functions

We want to convince the dart2js compiler about the types of some JSON
fields. This is still not working but sooner or later it will work.