Search code examples
objective-cjsonplist

Command-line tool for converting PLIST to JSON?


Is there a command line tool available for converting .plist files to JSON?

If not, what would be the approach for creating one using Objective-C or C on a Mac? For instance, there is JSONKit, for Objective-C. How would one go about opening a .plist file, pass it to JSONKit, and serialize that as JSON?


Solution

  • If you are on a Mac you can use the plutil tool on the command line (this comes with the developer tools I believe):

    plutil -convert json -o Data.json Data.plist
    

    If you want to just overwrite the existing file, you can omit the -o parameter:

    plutil -convert json Data.plist