Hi guys
i wonder how can i sort [price] in ascending order and select pickup only in [service_detail]
I tried the following but failed.
Please advice.
Dim priceArray As Array = jsonArray.result(0).rates.OrderBy(Function(x) x.price).ToArray()
CODEBEHIND
Protected Sub Page_Load(ByVal senderAs Object,ByVal eAs EventArgs)Handles Me.Load
If Not Me.IsPostBackThen
Dim pathAs String = Server.MapPath("~/Files/jsonString.txt")
Dim jsonStringAs String = File.ReadAllText(path)
Dim jsonArrayAs Root = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Root)(jsonString)
End If
End Sub
Public Class DropoffPoint
Public Property point_idAs String
Public Property point_nameAs String
Public Property point_contactAs String
Public Property point_addr1As String
Public Property point_addr2As String
Public Property point_addr3As String
Public Property point_addr4As String
Public Property point_postcodeAs String
Public Property point_cityAs String
Public Property point_stateAs String
Public Property start_timeAs String
Public Property end_timeAs String
Public Property priceAs Integer
End Class
Public Class PgeonPoint
Public Property Sender_pointAs List(Of SenderPoint)
Public Property Receiver_pointAs List(Of ReceiverPoint)
End Class
Public Class Rate
Public Property rate_idAs String
Public Property service_detailAs String
Public Property service_idAs String
Public Property service_typeAs String
Public Property courier_idAs String
Public Property courier_logoAs String
Public Property scheduled_start_dateAs String
Public Property pickup_dateAs String
Public Property deliveryAs String
Public Property priceAs String
Public Property addon_priceAs String
Public Property shipment_priceAs String
Public Property require_min_orderAs Integer
Public Property service_nameAs String
Public Property courier_nameAs String
Public Property dropoff_pointAs List(Of DropoffPoint)
Public Property pickup_pointAs List(OfObject)
End Class
Public Class ReceiverPoint
Public Property point_idAs String
Public Property companyAs String
Public Property point_nameAs String
Public Property point_contactAs String
Public Property point_latAs String
Public Property point_lonAs String
Public Property point_addr1As String
Public Property point_addr2As String
Public Property point_addr3As String
Public Property point_addr4As String
Public Property point_cityAs String
Public Property point_stateAs String
Public Property point_postcodeAs String
Public Property priceAs String
End Class
Public Class Result
Public Property REQ_IDAs String
Public Property statusAs String
Public Property remarksAs String
Public Property ratesAs List(Of Rate)
Public Property pgeon_pointAs PgeonPoint
End Class
Public Class Root
Public Property api_statusAs String
Public Property error_codeAs String
Public Property error_remarkAs String
Public Property resultAs List(Of Result)
End Class
Public Class SenderPoint
Public Property point_idAs String
Public Property companyAs String
Public Property point_nameAs String
Public Property point_contactAs String
Public Property point_latAs String
Public Property point_lonAs String
Public Property point_addr1As String
Public Property point_addr2As String
Public Property point_addr3As String
Public Property point_addr4As String
Public Property point_cityAs String
Public Property point_stateAs String
Public Property point_postcodeAs String
Public Property priceAs String
End Class
RETURNED RESULT (jsonString.txt)
{
"api_status": "Success",
"error_code": "0",
"error_remark": "",
"result": [
{
"REQ_ID": "",
"status": "Success",
"remarks": "",
"rates": [
{
"rate_id": "EP-RR0M2NL",
"service_detail": "dropoff/pickup",
"service_id": "EP-CS0CH",
"service_type": "parcel",
"courier_id": "EP-CR0A",
"courier_logo": "https://s3-ap-southeast-1.amazonaws.com/easyparcel-static/Public/source/general/img/couriers/Pos_Laju.jpg",
"scheduled_start_date": "2020-07-21 Tuesday",
"pickup_date": "2020-07-21",
"delivery": "3-5 working day(s)",
"price": "8.00",
"addon_price": "0.00",
"shipment_price": "8.00",
"require_min_order": 0,
"service_name": "Poslaju Same Day Pick up (within WM)",
"courier_name": "POSLAJU NATIONAL COURIER",
"dropoff_point": [
{
"point_id": "EP-CB0MI",
"point_name": "Pos Malaysia Banting",
"point_contact": "03-3187 1437",
"point_addr1": "No. 101 Jalan Bunga, Pekan 2",
"point_addr2": "42700",
"point_addr3": "",
"point_addr4": "",
"point_postcode": "Banting",
"point_city": "",
"point_state": "sgr",
"start_time": "00:00:00",
"end_time": "00:00:00",
"price": 0
}
],
"pickup_point": []
},
{
"rate_id": "EP-RR0MCOV",
"service_detail": "pickup",
"service_id": "EP-CS0KS",
"service_type": "parcel",
"courier_id": "EP-CR0Z",
"courier_logo": "https://s3-ap-southeast-1.amazonaws.com/easyparcel-static/Public/source/general/img/couriers/CJ_Century.jpg",
"scheduled_start_date": "2020-07-21 Tuesday",
"pickup_date": "2020-07-21",
"delivery": "3-5 working day(s)",
"price": "7.80",
"addon_price": "0.00",
"shipment_price": "7.80",
"require_min_order": 0,
"service_name": "CJ Century",
"courier_name": "CJ Century Logistics Sdn Bhd",
"dropoff_point": [],
"pickup_point": []
},
{
"rate_id": "EP-RR0914N",
"service_detail": "dropoff",
"service_id": "EP-CS09J",
"service_type": "parcel",
"courier_id": "EP-CR0C",
"courier_logo": "https://s3-ap-southeast-1.amazonaws.com/easyparcel-static/Public/source/general/img/couriers/DHLeC.jpg",
"scheduled_start_date": "2020-07-21 Tuesday",
"pickup_date": "2020-07-21",
"delivery": "3-5 working day(s)",
"price": "7.30",
"addon_price": "0.00",
"shipment_price": "7.30",
"require_min_order": 0,
"service_name": "DHL eCommerce (Dropoff only)",
"courier_name": "DHL eCommerce",
"dropoff_point": [
{
"point_id": "EP-CB02X",
"point_name": "DHL ServicePoint - E3 Farmasi",
"point_contact": "",
"point_addr1": "71",
"point_addr2": "Jalan Bunga Tanjung 6A",
"point_addr3": "Taman Muda",
"point_addr4": "",
"point_postcode": "68000",
"point_city": "Ampang",
"point_state": "sgr",
"start_time": "00:00:00",
"end_time": "00:00:00",
"price": 0
}
],
"pickup_point": []
}
],
"pgeon_point": {
"Sender_point": [
{
"point_id": "PGEON_P_TA",
"company": "newsplus",
"point_name": "TES-S ALAM (43)",
"point_contact": "355105643",
"point_lat": "3.07191150",
"point_lon": "101.53883690",
"point_addr1": "LOT 20,1ST FLR TESCO SHAH ALAM,",
"point_addr2": "NO 3 JLN AEROBIK 13/43, SEKSYEN 13,",
"point_addr3": "",
"point_addr4": "",
"point_city": "SHAH ALAM",
"point_state": "sgr",
"point_postcode": "40100",
"price": "0.00"
}
],
"Receiver_point": [
{
"point_id": "PGEON_P_RP",
"company": "newsplus",
"point_name": "RKL-AMP PARK (271)",
"point_contact": "327111975",
"point_lat": "3.15987000",
"point_lon": "101.71910000",
"point_addr1": "AMPANG PARK STATION (UNDERGROUND),",
"point_addr2": "JLN AMPANG,",
"point_addr3": "",
"point_addr4": "",
"point_city": "KUALA LUMPUR",
"point_state": "kul",
"point_postcode": "50450",
"price": "0.00"
}
]
}
}
]
}