Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4   11.5   11.6    Statistic    FMM    Blog  

PList.ReadData

Read property list from data.

Component Version macOS Windows Linux Server iOS SDK
PList 11.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "PList.ReadData"; Data )   More

Parameters

Parameter Description Example
Data Pass text with XML or container with plist file. MyFile::PListData

Result

Returns JSON or error.

Description

Read property list from data.
Pass in either text with XML or container with plist file, which may be XML or binary format.

Since JSON doesn't have separate data types for date or blocks of bytes, this is converted to text. Data is base64 encoded. Since we can't preserve all details, reading and writing again is a loosely conversion.

Examples

Read plist:

MBS( "PList.ReadData"; "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
    <key>id</key>
    <integer>1234</integer>
</dict>
</plist>")

Example result:
{
  "id" : 1234
}

Read plist with date and data:

MBS( "PList.ReadData"; "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
    <key>id</key>
    <date>2020-04-27T17:10:51Z</date>
    <key>testdata</key>
    <data>
    BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMChARm
    ZmZmg83MTD+DMzNzPwGDAAAAP4Y=
    </data>
</dict>
</plist>")

Example result:
{
  "id" : "2020-04-27 17:10:51 +0000",
  "testdata" : "BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMChARmZmZmg83MTD+DMzNzPwGDAAAAP4Y="
}

See also

Created 29th August 2021, last changed 29th August 2021


PKey.Type - PList.ReadFile

Feedback: Report problem or ask question.




Links
MBS FileMaker Plugins

Start Chat