NSString 到 JSON 对象
我有一个字符串如下:
{:userid => "user", :password => "123"}
我在登录时将此字符串发布到服务器。但服务器接受 JSON 对象形式的所有内容。所以我需要将这个字符串转换为 JSON 对象。
此外,服务器再次以 JSON 对象的形式返回响应。那么如何将其转换回NSString呢?
I have a string as follows :
{:userid => "user", :password => "123"}
I am posting this string to server at login. But the server is accepting everything in the form of JSON object. So I need to convert this string into JSON object.
Also, the server is again returning the response as a JSON object. So how to convert it back to NSString?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以自己解析 JSON,也可以使用 iPhone 可用的 JSON 库之一。
您可以使用:
json-framework 或 jsonkit 或 TouchJSON
You can either parse JSON yourself or use one of the available JSON libraries for iphone.
You can use:
json-framework or jsonkit or TouchJSON
TouchJSON 项目可以帮助您解决此问题。
它允许您执行以下操作:
祝您好运!
The TouchJSON project can help you with this.
It allows you to do the following:
Good luck!