Public API For Generating JSON Datasets - a Public API for generating JSON datasets for demo purpose.

Really it is amazing stuff to generate the JSON kind of datasets, we can utilize in our demo purpose. Yesterday while watching some videos related to AngularJS, one of the author posted this use full technique. I would like to share the same tips to you guys. It was developed by Joe Maddalone.

If you want to follow him via twitter -

While providing a technical demo really it would be so useful to generate the JSON kind of datasets. Please find the below C#.Net code used to retrieve the JSON dataset's from the and bind it to the GridView.

  1. HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("{firstName}&lname={lastName}&tel={phone|format}&address={streetAddress}&city={city}&state={usState|abbr}&zip={zip}&pretty=true");  
  3. httpWebRequest.Method = WebRequestMethods.Http.Get;  
  4. httpWebRequest.Accept = "application/json";  
  6. HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();  
  7. string text = string.Empty;  
  8. using (var sr = new StreamReader(response.GetResponseStream()))  
  9. {  
  10.    text = sr.ReadToEnd();  
  11. }  
  12. DataTable dt = (DataTable)JsonConvert.DeserializeObject(text, (typeof(DataTable)));  
  13. dt.TableName = "EmployeeDetails";  
  15. GridView1.DataSource = dt;  
  16. GridView1.DataBind();  

The above code I have been used NewtonSoft JSON serialize component, in order to install this component please use the below methods.

Nuget package

Use the below power shell command in your power shell command window.

  1. Open Visual studio.
  2. Go to Tools menu and select Library packet manager -> Packet manager Console.
  3. Provide the below command in this window and it will add the appropriate assembly to your project.
    1. Install-Package Newtonsoft.Json -Version 6.0.8  

If you need more info about the NewtonSoft JSON component please refer the link -

Please visit the site contains lots of useful information, however you can use the other stuff's like Angular JS, JQuery, Vanilla JS example provide some sample code to invoke the Filltext JSON api.

Please find the attached code for your reference.

If you feel this article really helpful for you, please provide your valuable comments.

Up Next
    Ebook Download
    View all
    View all