Skip to content

Instantly share code, notes, and snippets.

@rolandoam
Created June 3, 2012 04:10
Show Gist options
  • Save rolandoam/2861824 to your computer and use it in GitHub Desktop.
Save rolandoam/2861824 to your computer and use it in GitHub Desktop.
NSDictionary to JSON with macruby
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