} else { return "Invalid JSON data (could not decode JSON data)"; } } if (isset($warning)) { echo $warning; } // Check for 'raw output' if (isset($_POST['rawoutput'])) { die(print_r($data, false)); } // we need to make the first 'root' tree element // $out = '<ul id="root"><li><img src="images/arrow.png" class="arrow" alt="+" />ROOT<ul id="first">'; $out = ''; $out .= make_tree($data, null); $out .= "</ul></li></ul>"; $tree = ''; return $out; } // call function if (isset($_POST)) { $tree = ''; // Check if we need to catch an URL or if we can simply pass the data // directly $json = $_POST['data']; // Remove magic quotes if available if (get_magic_quotes_gpc()) { $json = stripslashes($json); } echo json_viewer($json); }
<label for="showinvalidjson">Show invalid JSON</label> </p> </div> </fieldset> <input type="hidden" id="entrytype" name="entrytype" value="url" /> <input type="submit" value="Submit" name="submit" id="submit" /> </form> </fieldset> <hr /> <img src="img/loading.gif" alt="Loading..." id="loading" class="jshide" /> <button id="expandAll" class="jshide">Expand all nodes</button> <pre id="output"> <?php // If JavaScript is disabled this will still show the results if (isset($_POST['url'])) { require 'jsonviewer.php'; echo json_viewer($_POST['url']); } ?> </pre> <a href="http://www.haykranen.nl" style="width:200px;margin:0 auto;display:block;"> <img src="http://static.haykranen.nl/common/hknl_button_200.png" alt="" style="border:0;"/> </a> </div> <!-- /wrapper --> </body> </html>