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


Currently contains 1 post


July 30, 2012 15:24

mike tran

tariq (edit) Topic created 8 months ago Edit Topic

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

How do i embed this in an html page ?

Thanks, Tariq

Message edited by tariq (edit) 8 months ago
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