Added some type validation to the json parser