如何将json代码解析为url? [英] how to parse json code to url?
本文介绍了如何将json代码解析为url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我有jason代码和网址。
如何解析代码并获取数据?
url: http://api.tektravels.com/BookingEngineService_Air/AirService.svc/rest/Search
code:
{
" AdultCount":" 1",$
" ChildCount":" 1",
"InfantCount":"1","
""IsDomestic":"真实","
""DirectFlight":"" false",
"OneStopFlight":"false","
""JourneyType":"1","
""EndUserIp":"103.230.106.33 ",
" TokenId":" 604d4f5a-283e-4c42-8bbc-09e92934f81d",&b $ b" PreferredAirlines":null,
" Segments":[{
" Origin":" DEL",&b $ b" Destination":" BOM",
"FlightCabinClass":" 1",
" P referencedArrivalTime":" 2018-11-06T00:00:00",
" PreferredDepartureTime":" 2018-11-06T00:00:00"
} ],"
""来源":[" 6E"]
};
在此先感谢
解决方案
为此您必须发布请求
using(var httpClient = new HttpClient()){
var httpResponse = await httpClient.PostAsync(""" http://api.tektravels.com/BookingEngineService_Air /AirService.svc/rest/Search",jsoncontent);
if(httpResponse.Content!= null){
var response = await httpResponse.Content.ReadAsStringAsync();
}
}或参考以下链接
hello
i have jason code and a url.
how can i parse the code to the url and get data?
url: http://api.tektravels.com/BookingEngineService_Air/AirService.svc/rest/Search
code:
{"AdultCount": "1",
"ChildCount":"1",
"InfantCount": "1",
"IsDomestic": "true",
"DirectFlight": "false",
"OneStopFlight": "false",
"JourneyType": "1",
"EndUserIp": "103.230.106.33",
"TokenId": "604d4f5a-283e-4c42-8bbc-09e92934f81d",
"PreferredAirlines": null,
"Segments": [ {
"Origin": "DEL",
"Destination": "BOM",
"FlightCabinClass": "1",
"PreferredArrivalTime": "2018-11-06T00:00:00",
"PreferredDepartureTime": "2018-11-06T00:00:00"
}],
"Sources": ["6E"]
}; Thanks in advance
解决方案
For this you have to do post request
using (var httpClient = new HttpClient()) { var httpResponse = await httpClient.PostAsync(""http://api.tektravels.com/BookingEngineService_Air/AirService.svc/rest/Search",jsoncontent); if (httpResponse.Content != null) { var response = await httpResponse.Content.ReadAsStringAsync(); } }Or refer following link
这篇关于如何将json代码解析为url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文