Util

asJSONPrettyString

Convert an object to a pretty-printed JSON string.

Util.asJSONPrettyString(obj: Any) -> str

Parameters

obj: Object to convert.

Returns

A pretty-printed JSON string representation of the object.

convertToResult

Convert a response to a Result object if possible.

Util.convertToResult(r) -> Result or None

Parameters

r: Response object to convert.

Returns

Result object if conversion is successful, otherwise None.

asJSONString

Convert an object to a JSON string.

Parameters

Returns

fromJSONString

Convert a JSON string to an object of the specified class.

Parameters

Returns

fromJSONStringAsMap

Convert a JSON string to a dictionary.

Parameters

Returns

saveAsJSONString

Save an object as JSON to a file.

Parameters

Returns

fromStringToDate

Convert a string to a datetime object.

Parameters

Returns

fromDateToString

Convert a datetime object to a string.

Parameters

Returns

genRandomAlphaNum

Generate a random alphanumeric string of specified length.

Parameters

Returns

mapByDisplayNames

Map objects by display names.

Parameters

Returns

listByDisplayNames

List objects by display names.

Parameters

Returns

deepCopy

Create a deep copy of a dictionary.

Parameters

Returns

convertToListOfDict

Convert input object to a list of dictionaries.

Parameters

Returns

convertToList

Convert input object to a list.

Parameters

Returns

convertToInt

Convert input object to an integer.

Parameters

Returns

convertToDict

Convert input object to a dictionary.

Parameters

Returns

convertToBool

Convert input object to a boolean.

Parameters

Returns

uidToClassName

Extract class name from UID.

Parameters

Returns

uidToId

Extract ID from UID.

Parameters

Returns

uidToIdStr

Extract ID as string from UID.

Parameters

Returns

validateJson

Validate JSON string.

Parameters

Returns

toPrettyJSONString

Convert JSON string to pretty-printed JSON string.

Parameters

Returns

getCurrentLanguage

Get the current language.

Parameters

Returns

asUid

Convert class name and ID to UID.

Parameters

Returns

addObjectByPath

Add object to dictionary by path.

Parameters

Returns

removeLeadingChars

Remove leading characters from a string.

Parameters

Returns

removeLastCharIfMatches

Remove last character from a string if it matches a specified character.

Parameters

Returns

roundDouble

Round a floating-point number to specified decimal places.

Parameters

Returns

urlEncode

URL-encode a string.

Parameters

Returns

urlDecode

URL-decode a string.

Parameters

Returns

Last updated