plistinator icon

Open-Source Plist Code

Read & write plists, with code under Free, Open-source or other community licenses.

Property List Serializer by capnbishop

  • Source: Javascript (in wiki format)
  • License: CC-BY-SA 3.0
  • Serialization: Read-only
  • Project start: Sep 2009
  • Last update: Jan 2012
  • Formats supported: XML, all types, all depths

This looks to be a solid JS implementation of the Plist DTD, creating an in-memory heierarchy of objects. If you need a C# implementation for Unity 3D, see below.

Property List Serializer ported by Chris Danielson

  • Source: in C# (blog format)
  • License: CC-BY-SA 3.0 clarifying with author, but assumed to be same as the code its ported from
  • Project start: May 2011
  • Last update: Feb 2012
  • Serialization: Read-only
  • Formats supported: XML, all types, all depths

Ported from the Javascript version this C# version has reports of success from users. I have not tried it myself. If you need a Javascript implementation for Unity 3D, see above. There is another C♯ implementation (but less well polished) on paladin_t's website.

PlistCS by Mark Tilton, Animetrics

  • Source: in C# as Visual Studio project (on GitHub)
  • License: MIT as per file header
  • Project start: Dec 2011
  • Last update: Dec 2013
  • Serialization: Read-Write
  • Formats supported: XML/Binary, all types, all depths

Although this is framed as a Visual Studio solution it looks to be portable C# and so should work in most C# projects. I have not verified or used this library myself. If you need a C# implementation tailored for Unity 3D, see above. The ShootSoft plist editor was written using it which indicates perhaps that it works OK.

libplist originally by Jonathon Beck, now maintained by libmobiledevice.org

  • Source: in C with C++ bindings (github, so zip or src)
  • License: LGPL v2.0 dual-licensed with GPLv2
  • Project start: 2009
  • Last update: Jan 2014
  • Serialization: Read-Write
  • Formats supported: XML, Binary

Mature and stable library and part of a number of Linux projects that interface with iOS devices. Written in C and easily used from C++. Reads and writes both binary and XML format files. Good test coverage. Packages available for many linux and other systems. (Side note - plistinator does not use libmobiledevice.org's implementation, but instead uses its own C++ reader/writer code for Plists).

Animetrics (authors of a C# plist implementation listed above) also have a C++ implementation with an MIT license.

Cocoa/CocoaTouch from Apple for iOS and MacOSX

  • Source: see below - its a one-liner
  • License: too trivial to license (public domain)
  • Project start: n/a
  • Last update: n/a
  • Serialization: Read-Write
  • Formats supported: XML, Binary

For completeness here is all the code you need to read a Plist file under iOS or MacOSX using the NSDictionary class from Cocoa or CocoaTouch:

NSDictionary *mygameData = [NSDictionary dictionaryWithContentsOfFile:plistFilePath];

This will read a Plist file where the root element is a <dict> - to do the same for an array based plist use arrayWithContentsOfFile:. For both types the writeToFile:atomically: method can be used to serialize out the structure.

C and Python reference implementations

  • Source: tar.gz format (see below for Python)
  • License: APSL 2.0
  • Project start: 2003/li>
  • Last update: 2014
  • Serialization: Read-Write
  • Formats supported: XML, binary

If you are making an Open-Source project in C or C++ using this code from Apple is not a bad option. There's instructions in the tar-ball for compiling under linux, and the examples directory includes a plist tool written against the Core Foundation lite API. The binary plist implementation includes an authoritative listing of the binary plist format. Its this algorith and spec that Plistinator's own custom-coded reader-writer code was built from - so the code also is handy as reference.

Also on the Apple Open Source site is a handy Python implementation of Plist read-write, available under the APSL license.

Python

  • Source: n/a see examples
  • License: n/a (trivial)
  • Project start: 2003/li>
  • Last update: 2014
  • Serialization: Read-Write
  • Formats supported: XML, binary

Python ships with MacOSX and though we haven't researched it seems likely that the Python plist implementation is supported by Apple. Reading and writing plist with Python is about as trivial as it is with Objective-C.

pl = readPlist(pathOrFile)
print(pl["aKey"])

C++

Plistinator is written using Qt 5.4 which is a powerful cross-platform C++ framework. To get the source code to Qt 5.4.2 for all platforms, click the above link, or obtain it from the Qt Company.

The LGPL Open Source license under which Qt ships with Plistinator, confers various rights to you, the user; including to recompile the Qt libraries for your platform. To do that follow the documentation shown on the Qt website.

© Smithsoft Pty Ltd 2013. All rights reserved.

Privacy Policy | Icons by Icons8 licensed under CC-ND 3.0