Implemnted toJson.