Print Friendly

# Class YAHOO.ext.util.JSON

Package: | YAHOO.ext.util
Class: | JSON
Extends: | Object
Defined In: | JSON.js

Modified version of Douglas Crockford's json.js that doesn't mess with the Object prototype http://www.json.org/js.html
This class is a singleton and cannot be created directly.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| decode(`String json`) : Object | JSON
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError.
| encode(`Mixed o`) : String | JSON
Encodes an Object, Array or other value

## Public Events

This class has no public events.

## Method Details

### decode

`public function decode(`String json`)`
Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError.
Parameters:

- `json` : String
  The JSON string

Returns:

- `Object`
  The resulting object

This method is defined by JSON.

### encode

`public function encode(`Mixed o`)`
Encodes an Object, Array or other value
Parameters:

- `o` : Mixed
  The variable to encode

Returns:

- `String`
  The JSON string

This method is defined by JSON.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.