Created
June 3, 2012 04:10
-
-
Save rolandoam/2861824 to your computer and use it in GitHub Desktop.
NSDictionary to JSON with macruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework 'foundation' | |
require 'json' | |
dict = NSDictionary.dictionaryWithContentsOfFile("/path/to/your/dict.plist") | |
File.open("/path/to/your/file.json", "w+") { |f| f.write JSON.generate(dict) } | |
# pretty print: | |
# | |
# File.open("/path/to/your/file.json", "w+") { |f| f.write JSON.generate(dict, :indent => "\t", :object_nl => "\n") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment