From: Jonathan P. <jp...@dc...> - 2006-02-01 22:39:41
|
On 1 Feb 2006, at 18:51, David wrote: > From my existing Cocoa app I would like to pass several NSArray's > to Ruby, manipulate them in Ruby, serialize the arrays in JSON > format, and return that data back to Cocoa. Does this seem like a > reasonable task for the RubyCocoa bridge? > > I see ruby 1.8+ has a to_yaml method for objects but how do I > produce JSON format for the arrays? Assuming you have an NSArray instance my_array in ruby, can you just do: manipulate(my_array.to_a).to_yaml i.e., convert the NSArray to a real ruby Array, do some stuff on it, then convert that array to yaml/json? |