Streamline your JSON and your JavaScript by converting all JSON keys into practical JavaScript-style camelCase keys.
Convert this:
[
{
"Some Key (Seriously)" : "Some Value"
}
]
into this:
[{"someKey":"Some Value"}]
~ $ gem install json
~ $ git clone https://www.github.com/joshbeam/RubyJSONCamelizer.git
~/RubyJSONCamelizer/dist $ ruby main.rb #<original file> #<new file>
# => if new file exists already, it will confirm if you want to overwrite it
~/RubyJSONCamelizer/dist $ ruby main.rb ../../SomeProjectFolder/someData.json ../../SomeProjectFolder/newCamelizedData.json
Used primarily in this Periodic Table application to convert data into a streamlined format.
- Removes anything that's in parentheses from the keys
- Creates camelCase keys
Copyright © 2015 Joshua Beam (MIT License)