Skip to content

Instantly share code, notes, and snippets.

@EddyF
Last active December 20, 2015 19:49
Show Gist options
  • Save EddyF/6186105 to your computer and use it in GitHub Desktop.
Save EddyF/6186105 to your computer and use it in GitHub Desktop.
json encoding
foreach($data['data'] as $key => $data)
{
if(isset($data))
{
$var[$key] = array(
'balance' => $data->balance,
'date' => date('d/m', strtotime($data->date))
);
}
}
$json = json_encode($var, JSON_FORCE_OBJECT);
var varData = jQuery.parseJSON('<?php echo $json; ?>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment