Web developer, Norwich - Clive Portman

parseJSON and Expression Engine

Published under ExpressionEngine, Javascript, jQuery

Published on Saturday 20th August 2011

Start by creating a template which outputs a string of the format:

{
"variable":value",
"variable":"value",
"variable":"value"
} 

The squiggly brackets have to be on different lines to stop Expression Engine parsing the contents. Then receive it like so:

$.get("http://cliveportman.co.uk/json-template/", function($data) {  
	$obj = $.parseJSON($data);
	//console.log($obj);
});