prevent quoted null when to_json is called on nil relationship

This is an update to #23 from 2011 to target the release-1.2 branch rather than master given the divergence of those two branches, and abandonment of master. The impact and code change is the same as before…

---

Fixes the case where calling something like:

`resource.to_json(:relationships => { :nested_resource => { :only => [:id] } })`

When the nested resource returns nil, would return invalid JSON like…

```
{
  "id":1,
  "nested_resouce":"null"
}
```

Rather than valid JSON like…

```
{
  "id":1,
  "nested_resouce":null
}
```

(Note the quotes around null)