Dan Morrow
Dan Morrow

Reputation: 4481

warnings about "failed mapping nested object: (null)"

I'm getting JSON back from a REST call. I've created a mapping called "Teacher", which has 3 properties in it. Nothing special.

Another object "Classroom", has a property to the teacher object. So it looks something like this:

classroom : {
   roomNumber : "123",
   floor: 2,
   id : "A123",
   teacher: {
       name: "John Doe",
       specialty: "Science",
       homeroom: "128"
   },
}

The problem I'm getting is that sometimes a classroom has no dedicated "teacher", and I'm getting an empty object from the service:

teacher: { }

When I get this, RestKit gives me a warning, "failed mapping nested object: (null)".

I realize that it would be better if the service were to return "null", or no teacher property at all. But until I can convince the server guys otherwise, is there a way I can tell RestKit to not worry if I get an object like this?

Upvotes: 1

Views: 93

Answers (0)

Related Questions