com.caucho.quercus.lib.json
Class JsonModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.json.JsonModule
All Implemented Interfaces:
QuercusModule

public class JsonModule
extends AbstractQuercusModule


Field Summary
static int JSON_BIGINT_AS_STRING
           
static int JSON_ERROR_CTRL_CHAR
           
static int JSON_ERROR_DEPTH
           
static int JSON_ERROR_NONE
           
static int JSON_ERROR_STATE_MISMATCH
           
static int JSON_ERROR_SYNTAX
           
static int JSON_ERROR_UTF8
           
static int JSON_FORCE_OBJECT
           
static int JSON_HEX_AMP
           
static int JSON_HEX_APOS
           
static int JSON_HEX_QUOT
           
static int JSON_HEX_TAG
           
static int JSON_NUMERIC_CHECK
           
static int JSON_PRETTY_PRINT
           
static int JSON_UNESCAPED_SLASHES
           
static int JSON_UNESCAPED_UNICODE
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
JsonModule()
           
 
Method Summary
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
static Value json_decode(Env env, StringValue s, boolean assoc)
          Takes a JSON-encoded string and returns a PHP value.
static StringValue json_encode(Env env, Value val, int options)
          Returns a JSON-encoded String.
static int json_last_error(Env env)
           
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSON_ERROR_NONE

public static final int JSON_ERROR_NONE
See Also:
Constant Field Values

JSON_ERROR_DEPTH

public static final int JSON_ERROR_DEPTH
See Also:
Constant Field Values

JSON_ERROR_STATE_MISMATCH

public static final int JSON_ERROR_STATE_MISMATCH
See Also:
Constant Field Values

JSON_ERROR_CTRL_CHAR

public static final int JSON_ERROR_CTRL_CHAR
See Also:
Constant Field Values

JSON_ERROR_SYNTAX

public static final int JSON_ERROR_SYNTAX
See Also:
Constant Field Values

JSON_ERROR_UTF8

public static final int JSON_ERROR_UTF8
See Also:
Constant Field Values

JSON_HEX_TAG

public static final int JSON_HEX_TAG
See Also:
Constant Field Values

JSON_HEX_AMP

public static final int JSON_HEX_AMP
See Also:
Constant Field Values

JSON_HEX_APOS

public static final int JSON_HEX_APOS
See Also:
Constant Field Values

JSON_HEX_QUOT

public static final int JSON_HEX_QUOT
See Also:
Constant Field Values

JSON_FORCE_OBJECT

public static final int JSON_FORCE_OBJECT
See Also:
Constant Field Values

JSON_NUMERIC_CHECK

public static final int JSON_NUMERIC_CHECK
See Also:
Constant Field Values

JSON_BIGINT_AS_STRING

public static final int JSON_BIGINT_AS_STRING
See Also:
Constant Field Values

JSON_PRETTY_PRINT

public static final int JSON_PRETTY_PRINT
See Also:
Constant Field Values

JSON_UNESCAPED_SLASHES

public static final int JSON_UNESCAPED_SLASHES
See Also:
Constant Field Values

JSON_UNESCAPED_UNICODE

public static final int JSON_UNESCAPED_UNICODE
See Also:
Constant Field Values
Constructor Detail

JsonModule

public JsonModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

json_encode

public static StringValue json_encode(Env env,
                                      Value val,
                                      int options)
Returns a JSON-encoded String. JSON strings can be in any Unicode format (UTF-8, UTF-16, UTF-32). Therefore need to pay special attention to multi-char characters.

Parameters:
env -
val - to encode into json format
Returns:
String JSON-encoded String

json_decode

public static Value json_decode(Env env,
                                StringValue s,
                                boolean assoc)
Takes a JSON-encoded string and returns a PHP value.

Parameters:
env -
s - JSON-encoded string.
assoc - determines whether a generic PHP object or PHP associative array should be returned when decoding json objects.
Returns:
decoded PHP value.

json_last_error

public static int json_last_error(Env env)