I am querying an external service which is passing back JSON data. I’d like to format this data as a binary PList to send it out to clients. How can I do that conversion in Rails? This is a complex data structure with arrays & hashes as well as strings & integers.
Based on the comment, I am trying this:
def friends_facebook
@graph = Koala::Facebook::GraphAPI.new(current_user.facebook_token.token)
render :plist => JSON.parse(@graph.get_connections("me", "friends").to_json)
end
Which results in the error (on the render line):
incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
Using http://plist.rubyforge.org/ and http://flori.github.com/json/ :
You might have to write your own
to_plist_nodemethod(s) for your data structure(s).