add ToJSON() and test.