用于将PLIST转换为JSON的命令行工具? [英] Command-line tool for converting PLIST to JSON?

查看:143
本文介绍了用于将PLIST转换为JSON的命令行工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在可用于将.plist文件转换为JSON的命令行工具?

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

如果没有,在Mac上使用Objective-C或C创建一个的方法是什么?例如,有用于Objective-C的JSONKit.如何打开一个.plist文件,将其传递给JSONKit,然后将其序列化为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?

推荐答案

如果您使用的是Mac,则可以在命令行上使用plutil工具(我相信这是开发人员工具附带的工具):

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 Data.plist

如注释中所述,

将覆盖现有数据.输出到新文件

as mentioned in the comments, this will overwrite the existing data. To output to a new file

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

这篇关于用于将PLIST转换为JSON的命令行工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆