added toJson and fromJson serialized methods.