Package FuzzManager :: Package FTB :: Package Signatures :: Module JSONHelper
[hide private]
[frames] | no frames]

Module JSONHelper

source code

JSONHelper

Various functions around JSON encoding/decoding


Author: Christian Holler (:decoder)

License:

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Contact: choller@mozilla.com

Functions [hide private]
list
getArrayChecked(obj, key, mandatory=False)
Retrieve a list from the given object using the given key
source code
string
getStringChecked(obj, key, mandatory=False)
Retrieve a string from the given object using the given key
source code
long
getNumberChecked(obj, key, mandatory=False)
Retrieve an integer from the given object using the given key
source code
string or dict
getObjectOrStringChecked(obj, key, mandatory=False)
Retrieve an object or string from the given object using the given key
source code
string or number
getNumberOrStringChecked(obj, key, mandatory=False)
Retrieve a number or string from the given object using the given key
source code
 
__getTypeChecked(obj, key, valTypes, mandatory=False) source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

getArrayChecked(obj, key, mandatory=False)

source code 

Retrieve a list from the given object using the given key

Parameters:
  • obj (map) - Source object
  • key (string) - Key to retrieve from obj
  • mandatory (bool) - If True, throws an exception if the key is not found
Returns: list
List retrieved from object

getStringChecked(obj, key, mandatory=False)

source code 

Retrieve a string from the given object using the given key

Parameters:
  • obj (map) - Source object
  • key (string) - Key to retrieve from obj
  • mandatory (bool) - If True, throws an exception if the key is not found
Returns: string
String retrieved from object

getNumberChecked(obj, key, mandatory=False)

source code 

Retrieve an integer from the given object using the given key

Parameters:
  • obj (map) - Source object
  • key (string) - Key to retrieve from obj
  • mandatory (bool) - If True, throws an exception if the key is not found
Returns: long
Number retrieved from object

getObjectOrStringChecked(obj, key, mandatory=False)

source code 

Retrieve an object or string from the given object using the given key

Parameters:
  • obj (map) - Source object
  • key (string) - Key to retrieve from obj
  • mandatory (bool) - If True, throws an exception if the key is not found
Returns: string or dict
String/Object object retrieved from object

getNumberOrStringChecked(obj, key, mandatory=False)

source code 

Retrieve a number or string from the given object using the given key

Parameters:
  • obj (map) - Source object
  • key (string) - Key to retrieve from obj
  • mandatory (bool) - If True, throws an exception if the key is not found
Returns: string or number
String/Number object retrieved from object