Added toJSON and from JSON support