check for null before calling json_object_get_type