Skip to content

Instantly share code, notes, and snippets.

@g8up
Created July 21, 2017 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g8up/574ada2dfb4b66a6a9edaac2c8678fcd to your computer and use it in GitHub Desktop.
Save g8up/574ada2dfb4b66a6a9edaac2c8678fcd to your computer and use it in GitHub Desktop.
convert plist to json
# @file plist2json.py
# @desc convert plist to json
# @usage >python plist2json.py FILE_NAME
# @test under python v2.7
# @author g8up
# @date 2017.7.21
import sys
import json
from plistlib import readPlist
def main ():
for filename in sys.argv [1:]:
plist = open(filename)
plist_object = readPlist(plist)
json_serialized = json.dumps(plist_object)
print json_serialized
if __name__ == "__main__":
main ()
@g8up
Copy link
Author

g8up commented Nov 12, 2018

sublimeText's config files may be a .plist file( xml)

<?xml version="1.0" encoding="UTF-8"?>

<dict>
  <key>Build Version</key>
  <string>10B329</string>
  <key>Device Name</key>
  <string>“Administrator”的 iPod</string>
  <key>Display Name</key>
  <string>“Administrator”的 iPod</string>
</dict>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment