<!--
{
  "availability" : [
    "iOS: 2.0.0 - 8.0.0",
    "iPadOS: 2.0.0 - 8.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.0.0 - 10.10.0",
    "tvOS: 9.0.0 - 9.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/PropertyListSerialization/dataFromPropertyList(_:format:errorDescription:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPropertyListSerialization(cm)dataFromPropertyList:format:errorDescription:"
  },
  "title" : "dataFromPropertyList(_:format:errorDescription:)"
}
-->

# dataFromPropertyList(_:format:errorDescription:)

This method is obsolete and will be deprecated soon.

```
class func dataFromPropertyList(_ plist: Any, format: PropertyListSerialization.PropertyListFormat, errorDescription errorString: UnsafeMutablePointer<NSString?>?) -> Data?
```

## Parameters

`plist`

A property list object.

`format`

A property list format. For possible values, see [`PropertyListSerialization.PropertyListFormat`](/documentation/Foundation/PropertyListSerialization/PropertyListFormat).

`errorString`

Upon return, if the conversion is successful, `errorString` is `nil`. If the conversion fails, upon return contains a string describing the nature of the error.

## Return Value

An `NSData` object containing `plist` in the format specified by `format`.

## Discussion

This method is obsolete and will be deprecated soon. Use [`data(fromPropertyList:format:options:)`](/documentation/Foundation/PropertyListSerialization/data(fromPropertyList:format:options:)) instead.

## See Also

[`+  dataWithPropertyList:format:options:error:`](/documentation/Foundation/PropertyListSerialization/data(fromPropertyList:format:options:))

Returns an `NSData` object containing a given property list in a specified format.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)