Ruby on rails 如何在Rails中将JSON数据转换为PList数据?
我正在查询一个正在传回JSON数据的外部服务。我想将此数据格式化为二进制PList,以便将其发送给客户端。如何在Rails中进行转换?这是一个复杂的数据结构,包含数组和哈希以及字符串和整数 根据评论,我正在尝试:Ruby on rails 如何在Rails中将JSON数据转换为PList数据?,ruby-on-rails,json,Ruby On Rails,Json,我正在查询一个正在传回JSON数据的外部服务。我想将此数据格式化为二进制PList,以便将其发送给客户端。如何在Rails中进行转换?这是一个复杂的数据结构,包含数组和哈希以及字符串和整数 根据评论,我正在尝试: def friends_facebook @graph = Koala::Facebook::GraphAPI.new(current_user.facebook_token.token) render :plist => JSON.parse(@graph.get_co
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
这将导致错误(在渲染线上):
使用和:
您可能需要为数据结构编写自己的到_plist_node
方法。使用和:
您可能需要为数据结构编写自己的
到_plist_node
方法。非常感谢您的评论。考虑到你的观点,我修改了我的问题。您建议我如何继续?非常感谢您的评论。考虑到你的观点,我修改了我的问题。你建议我怎么继续?
incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
JSON.parse(input).to_plist