(Moved to correct category: Developers > Ruby API )
Here is a method that creates a hash internally, then converts it to JSON.
It can be modified and renamed, omit the the call to load the json library, remove the last statement that creates the JSON String object, and replace it with a “return h” statement:
Basically this:
def self.get_attrs( obj, dict_name )
d = obj.attribute_dictionary(dict_name,false)
return false if d.nil?
h = {} # create a hash
d.each_pair {|k,v| h[k]=v }
return h
end