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
 
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.
 Value json_decode(Env env, StringValue s, boolean assoc)
          Takes a JSON-encoded string and returns a PHP value.
 StringValue json_encode(Env env, Value val)
          Returns a JSON-encoded String.
 
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
 

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 StringValue json_encode(Env env,
                               Value val)
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 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.