Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 13 revisions

The JSON helper is a simple interface to the Pear Services_JSON class created by Michal Migurski, Matt Knapp, and Brett Stimmerman.

Only two functions exist, json_encode and json_decode. Both functions take one parameter, the data to be encoded/decoded.

Once data is encoded, it is decoded in Javascript as so (brackets should be parentheses): [code]eval[var decoded_data = " + encoded_data];[/code]

Save the two attached files to your system/helpers directory. Load it like any other helper: [code]$this->load->helper('json');[/code]

File:json_helper.php File:JSON.php

Clone this wiki locally