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.
To convert a JSON document to XML, follow these steps: Select the JSON to XML action from the Tools > JSON Tools menu. Choose or enter the Input URL of the JSON document. Choose the path of the Output file that will contain the resulting XML document.
Apple Property List (PLIST) files are used to store serialized objects. They are mostly used in macOS, iOS, NeXTSTEP, and GNUstep programming frameworks.
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.
I wrote an online converter to do this. Please have a try.
http://json2plist.sinaapp.com/
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With