Reputation: 643
I'm writing REST JSON services for Android and iOS mobile devices, but Ruby, Java and Objecive-C have different code styles. I'm looking for best way to write code in Ruby style, but consider the requirements of other languages. Thanks!
Upvotes: 0
Views: 1582
Reputation: 16300
Many rails developers have run into this issue. The JSON and JavaScript best practice is to use camelCase for property names.
I found usinging .camelize(:lower) on any returned JSON to be the easiest way to do this.
The other conversion from camelCase to under_score is described here: Converting camel case to underscore case in ruby
I have looked for something close to C#'s JSON.NET for Ruby as far as flexibility, but have not found it.
Upvotes: 1