Change __toString() to output the JSON representation since it's easier to skim
Throw exception if attributes is not an array.