Welcome Guest. Sign in or Signup

b) JSON

Posted on June 10, 2014 0 Comments

Why does my JSON string get truncated when it goes above a certain size?

Make sure to adjust your webservice’s max json length property. In ASP.NET, you can do so as follows:

Posted on November 20, 2012 2 Comments

How to Filter JSON data using jQuery ?

This sample shows, how to filter the JSON data by its item, jQuery.grep() will filter the array which satisfy a filter function, so here we are using the $.grep to filter JSON data.

Posted on June 19, 2012 0 Comments

How to parse an XML string and retrieve the values from the XML list?

Here is some sample code that does this:

Posted on May 14, 2012 0 Comments

How to parse a date string disregarding time zones?

Usually when you parse a date string, it’s in ISO format and the converted Date object will be in the browser’s current culture format. // This localDate will not however be "Jan 1st 2012, 12AM". It will instead be adjusted to a local time // like "Dec 31st, 2011, 7PM" if you are in US […]

Posted on May 14, 2012 1 Comments

How to convert a date string in your JSON string to a Date object?

The parseJSON and the JSON.parse both do not have the capability to parse date strings (in ISO or any other format) into Date objects. So, here is a post that uses a jQuery extension to automatically parse ASP.NET and ISO format date strings.

Posted on May 14, 2012 0 Comments

How to convert an object to a JSON string?

Use the JSON.stringify method as shown below to convert a json object to a string. The 2nd replacer function argument allows you to control conversion of individual items. var myJSONText = JSON.stringify(myObject, fnReplacer);

Posted on May 14, 2012 1 Comments

How to convert a JSON string to an object?

jQuery has a parseJSON method that does this JSON string to object conversion. Like this: var myJSONObj = $.parseJSON(myJSONString); However, JSON.parse API below provides you more flexibility in controling how individual items are converted to objects. var myJSONObj = window.JSON.parse(jsonString, fnConverter); This is elaborated in more detail in this JSON in JavaScript topic.