A Python package to convert files between JSON, plist, and mobileconfig 'Custom Settings' formats.
Project description
JSON-Plist-Mobileconfig Converter
JSON-Plist-Mobileconfig Converter is a Python package that facilitates the conversion between JSON, plist, and mobileconfig ("Custom Settings") formats.
Features
- JSON to Plist: Convert JSON files to plist format.
- Plist to JSON: Convert plist files to JSON format.
- Plist to Mobileconfig: Embed plist files into a mobileconfig file for distributing, or forcing, custom settings on Apple devices.
- JSON to Mobileconfig: Directly convert JSON files to mobileconfig format for distributing, or forcing, custom settings on Apple devices.
Installation
You can install the package from PyPI using the following command:
pip install json-plist-mobileconfig
Alternatively, you can clone the repository to your local machine:
git clone https://github.com/rjocoleman/json-plist-mobileconfig.git
Navigate to the project directory:
cd json-plist-mobileconfig
Although the script uses only the Python standard library, if you add any external dependencies in the future, you can install them using:
pip install -r requirements.txt
Usage
As a Command-Line Tool
You can use the script as a command-line tool with the following syntax:
json-plist-mobileconfig input_file [--plist] [--json] [--mobileconfig] [options]
(Or not installed via the PyPI package python ./json-plist-mobileconfig.py)
Arguments
input_file: The path to the input JSON or plist file. (Required)--plist: If specified, outputs a plist file.--json: If specified, outputs a JSON file.--mobileconfig: If specified, outputs a mobileconfig file with embedded plist data.
Options
--uuid UUID: Specifies the UUID for the mobileconfig file. A new UUID is generated if not specified.--removal_disallowed: Disallows removal of the mobileconfig file. Default is false.--identifier IDENTIFIER: Specifies the identifier for the mobileconfig file. Default is 'com.example.customsettings'.--payload_version PAYLOAD_VERSION: Specifies the payload version for the mobileconfig file. Default is 1.--payload_display_name PAYLOAD_DISPLAY_NAME: Specifies the payload display name for the mobileconfig file. Default is 'Custom Settings'.--version: Displays the version of the script.
As a Library
You can also use the script as a library in other Python scripts. Here's an example of how to use the functions in the script:
import script_name
# Read data from a JSON or plist file
data = script_name.read_input_file('input_file.json')
# Convert data to plist format
plist_data = script_name.convert_to_plist(data)
# Convert data to JSON format
json_data = script_name.convert_to_json(data)
# Create a mobileconfig file with embedded plist data
mobileconfig_data = script_name.create_mobileconfig(plist_data, uuid, removal_disallowed, identifier, payload_version, payload_display_name)
Credits
mcxToProfile - does something similar, and has a different feature set but relies on external libraries and was harder for me to run
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file json_plist_mobileconfig-0.1.0.tar.gz.
File metadata
- Download URL: json_plist_mobileconfig-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ba64694a21af97e4f878bebedfb7f05d058a2d15439b3af7eabe643fa4513e4
|
|
| MD5 |
72d513b668fbe108f0d38d2103885e33
|
|
| BLAKE2b-256 |
9bac6efdbab7560469bdaf83d2790f7320c217b60bb700f41a51bd9641168e17
|
File details
Details for the file json_plist_mobileconfig-0.1.0-py3-none-any.whl.
File metadata
- Download URL: json_plist_mobileconfig-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f0c2c8c3d0f4fe88937987e4dcea57344126f2d8ec230056d5a5722487cac77
|
|
| MD5 |
f0fc9402dc624948ca68a443e9c14bff
|
|
| BLAKE2b-256 |
fba7a07f246c1ce5ace33315e7d1c22486c0b16e99d067abbdeb2404e8cef4a6
|