JSON object attributes

var myjson = { id: 01,

                              name: ‘dilip’,

                              siteaddress: ‘https://d4dilip.wordpress.com’ };

for(var att in myjson)

{ console.log(att); }

 

Output

id

name

siteaddress

Advertisements

ASP NET Web Api : make it pure JSON api

by default , web api can support json as well as xml rsponse. but its nice to have api which only returns JSON  data. 

To achieve it ,remove XmlFormatter 🙂

 

GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();