Change from toJson to toObject.