This is a very simple gem that allows to generate a plist from any json and comes with a handy command line tool to do that also with files.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install json2plist
In your code
You can use it in your app by just using the convert method in the library:
require 'json2plist' # Generate your wonderful plist plist = Json2plist::convert(json) # Do whatever you want with it File.write("/somewhere/over/the/rainbow.plist", plist)
Or you can use the command line:
json2plist -i some.json -o wonderful.plist
Why would you create this thing?
Doing this with ruby is straightforward, but not everyone in our team are Ruby developers, and sometimes we have to convert JSON into Plist in our build processes. For example: We use this gem to maintain configuration options for our Android and iOS apps in one single place, we edit only the JSON files and then a plist is generated for iOS joy.
Don't think about using this to generate Plist files from Ruby hashes or objects by converting them into a JSON first. For this use the awesome plist gem.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request