In php:
convert php array to json:
$arr=array(‘name’=>’testre’,’obj’=>’json’ );
echo json_encode(array(‘result’=>’saved successfully’));
OUTPUT:
‘{“name”:”testre”,”obj”:”json”}’
NOW JQUERY :
var obj = jQuery.parseJSON(‘{“name”:”testre”,”obj”:”json”}’);
alert( obj.name );