JSON GET和POST [英] JSON GET and POST

查看:95
本文介绍了JSON GET和POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习iOS应用开发. 我有JSON数据以Dictionary的形式来自一个站点中的一个Array,在该Dictionary中,我有另一个Array并且包含另一个Dictionary. 对于ex,

I am learning iOS app development. I have JSON data coming from one of the sites in the form of Dictionary within an Array and within that Dictionary I have another Array and that contains another Dictionary. for ex ,

现在我想反序列化它并在我的iOS应用程序中使用它,而且我还必须将一些数据(例如评论)发回到服务器上.老师的评论将是对服务器的POST.

Now I want to deserialize it and use it in my iOS app and also I have to post some data like a comment back to the server.The comment by teacher will be a POST to the server.

我希望这个问题有意义.

I hope the question makes sense.

我一直坚持如何反序列化并使用POST进行服务器处理.

I am stuck on how to deserialize this and use POST to server.

感谢您的帮助.预先感谢.

Any help is appreciated. Thanks in advance.

推荐答案

您的问题有两个部分:

1)要将JSON数据转换成易于被您的程序操纵的格式,最简单的方法是采用现有的开源JSON解析器库并将其集成到您的应用程序中.我喜欢 SBJSON .如果您访问该站点,它会提供有关在项目中包括和使用该库的说明.

1) To get the JSON data into a format which can easily be manipulated by your program, it's easiest to take an existing open-source JSON parser library and integrate it into your app. I like SBJSON. If you go to that site, it has instructions on including and using the library in your project.

2)要向服务器发送回复,您需要知道其期望数据采用的格式.您的应用是否正在与现有网站进行交互(用户可以在其中访问页面并填写表格),或者是在和API通信吗?

2) To post a reply to the server, you need to know what format it expects the data in. Is your app interacting with an existing website (where a user could go to a page and fill out a form), or is it talking to an API?

这篇关于JSON GET和POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆