1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/plist.md
Kelly Brazil cb3484e1ab doc update
2022-08-04 15:43:44 -07:00

1.8 KiB

Home

jc.parsers.plist

jc - JSON Convert PLIST file parser

Converts binary and XML 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:

List of Dictionaries. Raw or processed structured data.

Parser Information

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

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