Altered test to compare contents of the JSON object.

The test was converting the object to a String and testing that, which sometimes passed and often failed.