Namespace RapidContext.Encode

Encode

Provides functions for encoding and decoding data.

Method Summary
(static)
Serializes a value to JSON.
(static)
Serializes a value to a URL component.
(static)
Serializes an object to a URL query string.

Methods

(static) toJSON(val) → {string}

Serializes a value to JSON. The value is serialized by JSON.stringify, but unicode escape sequences are inserted for any non-printable ASCII characters.

Parameters:
Name Type Description
val {Object} the value to serialize
Returns:
{string} the JSON string
Source:
RapidContext_Encode.js, line 41

(static) toUrlPart(val, isForm) → {string}

Serializes a value to a URL component. The value is serialized by encodeURIComponent, but any non-String values are first converted to strings.

Parameters:
Name Type Description
val {Object} the value to serialize
isForm {Object} the flag for using + instead of %20
Returns:
{string} the URL-encoded string
Source:
RapidContext_Encode.js, line 56

(static) toUrlQuery(val, isForm) → {string}

Serializes an object to a URL query string. If an object value is an array, each entry will be added to the query separately.

Parameters:
Name Type Description
val {Object} the key-value pairs to serialize
isForm {Object} the flag for using + instead of %20
Returns:
{string} the URL-encoded query string
Source:
RapidContext_Encode.js, line 72