Json Parsing Problem with Dotnet webserivces - iphone

I am posting some values to dotnet webservice.For this i am using AsiFormDataRequest.Values are posted suceesfully but coming response is in xml format. so iam not able to get the success or failure message in json format.
What i want to do for getting json response after posting to server.
Thanking in advance.

You need to configure the server to respond with JSON instead of XML. There is nothing you can do about this from within your app. If you don't have control over the server then you need to forget JSON and parse the XML instead.

Related

http POST vs GET request for getting a document sending a XML file

I know for getting a data we have to use a GET request. But this time I have to send a XML document (who will not be stored) for getting the data. What are the best practice in this case ?
You need send a xml document to your end-point to get your interested data.
As you need a xml doc, it has to be a POST REST end-point. (On a side note, sending any file contents as part of GET parameters is a bad design practice.)

How to check if request type is JSON in a Sinatra app?

I need to parse a request body as JSON, but how do I check if the request is a JSON request?
Have you tried request.content_type?
But the response could be a plain text and still be a valid JSON, so I think it would be valid to get the contents and try to parse it.

How to remove HTML content from REST API response?

I have started to work with REST APIs - specifically JIRA REST APIs.
I'm using the API to get response to a JIRA query but the JSON response I am getting contains lot of HTML chunk inside it.
It is not clean enough as showcased here
How can I use it in such a way to get a proper JSON response?
I think, JIRA response in JSON format only if request is successful, if request has any error than it comes in HTML response. actually that html belongs to the JIRA's error page. So correct your request, you will not get any response in HTML fomat. :)

Getting information from an online database with iOS

I'm trying to query the ncbi public database. When I look at the network stream, all I can see is that the response header is text/html. Does that mean I have to parse the text/html in iOS to get the information I want in a database? Thanks.
If you are getting data in the form of a HTML document, you will indeed have to parse the HTML to extract the data.

post xml from iphone to server

How can I post XML data format to server?
(I only know post paramters to server)
Thank you!
It will depend on the server. You could get the NSData -bytes representation of the XML data and, if you're working with a RESTful web application, use PUT or POST when sending the data.