我正在查询一个传回 JSON 数据的外部服务。我想将此数据格式化为二进制 PList 以将其发送给客户端。如何在 Rails 中进行转换?这是一个复杂的数据结构,包含数组和哈希以及字符串和整数。
根据评论,我正在尝试这个:
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
导致错误(在渲染线上):
incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)