[ad_1]
Saya memiliki JSON yang saya perlukan untuk membuat API di C# dari D365. Apakah ada paket yang dapat membantu saya dalam hal ini di C#? Saya belum pernah membuat API sebelumnya di C# jadi ini baru bagi saya. Apa yang saya perlukan untuk memasukkan kontrol di C#?
"d365EntityName": "account", "entityAlias": "account", "crmId": "0575ac39-a3c1-4d01-8cfa-4e52278c8665", "companyName": "AUTOLIV", "divisionId": null, "divisionName": null, "advisor": "", "bdRia": null, "bdRiaName": null, "billingLocationId": null, "billingLocationName": null, "clientGroupInt": null, "clientGroupName": null, "dateLost": null, "dba": "", "effectiveDate": null, "employeeBenefitsCoverageTypeInt": 867460000, "employeeBenefitsCoverageTypeName": "Group", "fein": "", "sicId": null, "sicName": null, "industryId": null, "industryName": null, "integrationMessage": "", "integrationStatus": "", "mainPhone": "", "numberOfEmployees": 23, "ownerName": "Tricia McCann", "regionInt": null, "regionName": null, "relationshipStatus": 3, "relationshipStatusName": "Green", "shippingLocationId": null, "shippingLocationName": null, "sourceId": "", "sourceSystem": null, "stateId": "99f9b75d-860b-ea11-a814-000d3a55d7ac", "stateName": "Arizona", "termedDate": null, "parentAccountId": "c39aaadf-dd6d-ea11-80db-005056912bbc", "parentAccountName": "DBA - St. Louis-MO (Centro Benefits Research LLC)", "companyTypeInt": 867460001, "companyTypeName": "Client", "brokerBooks": null, "products": null, "parentAccount": null, "name": null, "statusCodeInt": 1, "statusCodeName": "Active", "stateCodeInt": 0, "stateCodeName": "Active", "createdOn": "2023-07-10T09:22:08Z", "createdById": "c57e6623-2fbf-ed11-83ff-6045bdf05c47", "createdByName": "# D365 - Operational API User", "modifiedOn": "2023-11-17T07:40:19Z", "modifiedById": "c57e6623-2fbf-ed11-83ff-6045bdf05c47", "modifiedByName": "# D365 - Operational API User", "ownerId": "67f1f314-c74e-ea11-a813-000d3a55d7ac"
Apa yang saya coba:
C#
<pre>namespace Benchmarking.Services.Api.Models { public class AccountDetails { [JsonProperty("App")] public App App { get; set; } [JsonProperty("Name")] public string Name { get; set; } [JsonProperty("Account Id")] public Guid AccountId { get; set; } [JsonProperty("Number of Employees")] public int NumberOfEmployees { get; set; } [JsonProperty("State Name")] public string StateName { get; set; } [JsonProperty("Industry Code")] public string IndustryCode { get; set; } [JsonProperty("Partner")] public string Partner { get; set; } [JsonProperty("User")] public User User { get; set; } [JsonProperty("Products")] public List<Product> Products { get; set; } } public partial class App { [JsonProperty("name")] public string Name { get; set; } [JsonProperty("id")] public string Id { get; set; } } public partial class Product { [JsonProperty("Name")] public string ProductName { get; set; } [JsonProperty("Product Type")] public string ProductType { get; set; } [JsonProperty("Product Plan Type")] public string ProductPlanType { get; set; } [JsonProperty("InsurancePlans")] public List<InsurancePlan> InsurancePlans { get; set; } [JsonProperty("PlanDetails")] public List<PlanDetail> PlanDetails { get; set; } [JsonProperty("PlanRates")] public List<PlanRate> PlanRates { get; set; } } public class InsurancePlan { public string PlanName { get; set; } public List<PlanDetail> PlanDetails { get; set; } public List<PlanRate> PlanRates { get; set; } } public partial class PlanDetail { [JsonProperty("Name")] public string Name { get; set; } [JsonProperty("Innetwork")] public string Innetwork { get; set; } [JsonProperty("Category")] public string Category { get; set; } } public partial class PlanRate { [JsonProperty("Tier Type")] public string TierType { get; set; } [JsonProperty("Rate Type")] public string RateType { get; set; } [JsonProperty("Transaction Currency Id")] public string TransactionCurrencyId { get; set; } [JsonProperty("Employee Rate Money")] public decimal? EmployeeRateMoney { get; set; } [JsonProperty("Employerate Money")] public decimal? EmployerateMoney { get; set; } [JsonProperty("Employee Rate Percent")] public decimal? EmployeeRatePercent { get; set; } [JsonProperty("Employer Rate Percent")] public decimal? EmployerRatePercent { get; set; } [JsonProperty("Contribution Unit")] public object? ContributionUnit { get; set; } [JsonProperty("Monthly Premium")] public decimal? MonthlyPremium { get; set; } } public partial class User { [JsonProperty("name")] public string Name { get; set; } [JsonProperty("userid")] public string Userid { get; set; } }
Solusi 1
Berikut adalah alat yang akan membuatnya sederhana: Utilitas JSON: Hasilkan C#, VB.Net, Tabel SQL, dan Java dari JSON[^].
Saya juga telah menulis artikel tentang bekerja dengan JSON yang mencantumkan lebih banyak alat dan teknik: >Bekerja dengan Newtonsoft.Json di C# & VB[^]
[ad_2]
コメント