Skip to the content.

Home

jc.parsers.plist

jc - JSON Convert PLIST file parser

Converts binary, XML, and NeXTSTEP PLIST files.

Binary values are converted into an ASCII hex representation.

Datetime objects are converted into Unix epoch timestamps and ISO strings. The timestamp and ISO string will maintain the same naive or timezone-aware properties as the object in the original PLIST file.

Usage (cli):

$ cat file.plist | jc --plist

Usage (module):

import jc
result = jc.parse('plist', plist_file_output)

Schema:

{
  "<key>":            string/integer/float/boolean/object/array/null
}

Examples:

$ cat info.plist | jc --plist -p
{
  "NSAppleScriptEnabled": true,
  "LSMultipleInstancesProhibited": true,
  "CFBundleInfoDictionaryVersion": "6.0",
  "DTPlatformVersion": "GM",
  "CFBundleIconFile": "GarageBand.icns",
  "CFBundleName": "GarageBand",
  "DTSDKName": "macosx10.13internal",
  "NSSupportsAutomaticGraphicsSwitching": true,
  "RevisionDate": "2018-12-03_14:10:56",
  "UTImportedTypeDeclarations": [
    {
      "UTTypeConformsTo": [
        "public.data",
        "public.content"
  ...
}

parse

def parse(data: Union[str, bytes],
          raw: bool = False,
          quiet: bool = False) -> Dict

Main text parsing function

Parameters:

data:        (string)  text data to parse
raw:         (boolean) unprocessed output if True
quiet:       (boolean) suppress warning messages if True

Returns:

Dictionary. Raw or processed structured data.

Parser Information

Compatibility: linux, darwin, cygwin, win32, aix, freebsd

Source: jc/parsers/plist.py

Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)