If you have a time, please check the below code and correct me if wrong
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
namespace Test_CustomerMasters
{
public class Class1
{
public string ConsumeJson()
{
Uri requestUri = new Uri("JsonApi");
WebRequest request = WebRequest.Create(requestUri);
request.Method = "GET";
request.ContentType = @"application/json; charset=utf-8";
var authHeader = "Tokenvalue";
request.Headers.Add("x-access-token", authHeader);
HttpWebResponse accountresponse = (HttpWebResponse)request.GetResponse();
string accountjsonres = null;
StreamReader sr12 = new StreamReader(accountresponse.GetResponseStream());
{
accountjsonres = sr12.ReadToEnd();
}
return accountjsonres;
}
public static CustomerList ReadToObject(string json)
{
return JsonConvert.DeserializeObject<CustomerList>(json);
}
}
public class CustomerList
{
public string goC_Code { get; set; }
public string customer_Name { get; set; }
public string currency { get; set; }
public object unit { get; set; }
public string customer_Telephone { get; set; }
public string customer_Fax { get; set; }
public string customer_Country { get; set; }
public string customer_State { get; set; }
public string customer_Zip { get; set; }
public string customer_city { get; set; }
public object customer_Street { get; set; }
public string customer_Mobile { get; set; }
public string customerDepartment { get; set; }
public string project { get; set; }
public string employee { get; set; }
public string purpose { get; set; }
public object customerContact { get; set; }
public string industryClassification { get; set; }
public string companyURL { get; set; }
public string customer_Type { get; set; }
public string taxGroup { get; set; }
public string payTerm { get; set; }
public object bu { get; set; }
public object sbu { get; set; }
public string street { get; set; }
public object city { get; set; }
public object state { get; set; }
public string zipCode { get; set; }
public object country { get; set; }
public int id { get; set; }
}
}