Added fn to pretty print JSON so this can run on php < 5.4