2022-07-31 16:14:04 -07:00
|
|
|
[Home](https://kellyjonbrazil.github.io/jc/)
|
|
|
|
<a id="jc.parsers.plist"></a>
|
|
|
|
|
|
|
|
# jc.parsers.plist
|
|
|
|
|
|
|
|
jc - JSON Convert PLIST file parser
|
|
|
|
|
2022-12-30 10:27:03 -08:00
|
|
|
Converts binary, XML, and NeXTSTEP PLIST files.
|
2022-07-31 16:14:04 -07:00
|
|
|
|
2022-08-04 11:43:49 -07:00
|
|
|
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.
|
|
|
|
|
2022-07-31 16:14:04 -07:00
|
|
|
Usage (cli):
|
|
|
|
|
|
|
|
$ cat file.plist | jc --plist
|
|
|
|
|
|
|
|
Usage (module):
|
|
|
|
|
|
|
|
import jc
|
2022-08-04 15:43:44 -07:00
|
|
|
result = jc.parse('plist', plist_file_output)
|
2022-07-31 16:14:04 -07:00
|
|
|
|
|
|
|
Schema:
|
|
|
|
|
2022-08-04 15:43:44 -07:00
|
|
|
{
|
|
|
|
"<key>": string/integer/float/boolean/object/array/null
|
|
|
|
}
|
2022-07-31 16:14:04 -07:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
2022-08-04 15:43:44 -07:00
|
|
|
$ 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"
|
|
|
|
...
|
|
|
|
}
|
2022-07-31 16:14:04 -07:00
|
|
|
|
|
|
|
<a id="jc.parsers.plist.parse"></a>
|
|
|
|
|
|
|
|
### parse
|
|
|
|
|
|
|
|
```python
|
|
|
|
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:
|
|
|
|
|
2022-12-30 11:46:40 -08:00
|
|
|
Dictionary. Raw or processed structured data.
|
2022-07-31 16:14:04 -07:00
|
|
|
|
|
|
|
### Parser Information
|
|
|
|
Compatibility: linux, darwin, cygwin, win32, aix, freebsd
|
|
|
|
|
2023-12-21 14:55:21 -08:00
|
|
|
Source: [`jc/parsers/plist.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/plist.py)
|
|
|
|
|
2024-02-10 11:16:38 -08:00
|
|
|
Version 1.2 by Kelly Brazil (kellyjonbrazil@gmail.com)
|