how to use the values returned by the api in a html page ?

Tagged:

Currently contains 1 post

Avatar

30 Jul, 2012 03:24PM

mike tran

tariq (edit) Topic created 8 months ago Edit Topic
Hi,

I am trying to learn and use the SierraTradingPost API. I am not a developer… I have a question on the values that are returned by http://api.sierratradingpost.com/api/1.0/brands/?api_key=some_key

How do i embed this in an html page ?

Thanks, Tariq

Message edited by tariq (edit) 8 months ago
Tags
html page, embed
stpapidemo (edit) – 8 months ago Edit Post

The API gives back data in JavaScript Object Notation (JSON). If it helps to visualize the JSON data, there are a number of sites that will make it easier to read. I have found this JSON viewer to be quite useful. It allows you to format raw JSON into a pretty structure in text as well as a tree navigator.

How you handle such data will be completely dependent on the system you are using to serve up the web pages in which you want to embed the data. Most programming languages have a methods for parsing (also called deserializing) JSON data into objects.

Since I spend most of my time in .NET, here are some options for it that I have at least spent a few seconds with:

.NET has the built-in JavaScriptSerializer.Deserialize method
ServiceStack.Text has DeserializeFromString(string json) method and the FromJson(this string) extension method
Newtonsoft’s Json.NET has the JsonConvert.DeserializeObject method
While it isn’t specific to the brand JSON, there is a purely JavaScript/jQuery API demo that simply spits out the API results into a page.

Reply to thread