Reputation: 13085
I have a JSON file that I exported from a web service. I need to convert this to a .plist file that I can import into the main bundle of an iOS app. What's the easiest way to do this?
Note - the app doesn't need to grab the JSON from a server or anything. This is a one-time conversion that I need to do. The app will always just use the plist. I just need to know how to convert it.
Upvotes: 40
Views: 22731
Reputation: 1413
I have a web app to convert data between JSON and PList:
https://github.com/fengchang/json2plist
Upvotes: 20
Reputation: 92
another online converter JSON to PList https://wtools.io/convert-json-to-plist
Upvotes: 0
Reputation: 1764
I'd recommend plutil on the command line.
plutil -convert xml1 in.json -o out.plist
It will blow up with NULL values in dictionaries and some other inconsistencies that iOS JSON deserialization will handle more gracefully, but it does appear to work pretty well.
Upvotes: 86
Reputation: 101
David's answer works pretty well, but as a Ruby lover I've written a very simple tool to do the same with ruby: https://github.com/javiertoledo/json2plist
Upvotes: 2