try {
Person p = Person.createPerson(editingContext, "Mike");
assertEquals("{\"type\":\"Person\",\"age\":null,\"name\":\"Mike\",\"salary\":null,\"company\":null}\n", ERXRestFormat.json().toString(p));
p.setAge(Integer.valueOf(25));
assertEquals("{\"type\":\"Person\",\"age\":25,\"name\":\"Mike\",\"salary\":null,\"company\":null}\n", ERXRestFormat.json().toString(p));
Company c = Company.createCompany(editingContext, "Company");
assertEquals("{\"type\":\"Company\",\"name\":\"Company\",\"revenue\":null,\"employees\":[]}\n", ERXRestFormat.json().toString(c));
p.setCompanyRelationship(c);
assertEquals("{\"type\":\"Person\",\"age\":25,\"name\":\"Mike\",\"salary\":null,\"company\":{\"type\":\"Company\",\"name\":\"Company\",\"revenue\":null,\"employees\":[{\"type\":\"Person\"}]}}\n", ERXRestFormat.json().toString(p));
assertEquals("{\"type\":\"Company\",\"name\":\"Company\",\"revenue\":null,\"employees\":[{\"type\":\"Person\",\"age\":25,\"name\":\"Mike\",\"salary\":null,\"company\":{\"type\":\"Company\"}}]}\n", ERXRestFormat.json().toString(c));
}