fixing the example to work with Apache web server and proper UTF-8 processing so the example Unicode (Japanese) is not corrupted irrevocably by PHP
fix: only use the PHP 5.4 default pretty printing JSON conversion when the input is NOT a JSON string yet! (otherwise you get very much unwanted results ;-) )
fix the indenting/whitespace handling in the code and always put a space after a colon after a field name