0

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!

extern.fx
  • 643
  • 1
  • 5
  • 9
  • Not sure it's a suitable question for SO. Anyway the best resource out there is the book Eloquent Ruby, imo. – lucapette Aug 22 '12 at 11:54

1 Answers1

1

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.

Community
  • 1
  • 1
Martin
  • 15,820
  • 4
  • 47
  • 56