JsonEncoder

Configs

1
encoder: Object

Configuration of the JSON encoder used by the Crud Manager.

ParameterTypeDescription
encoder.requestDataObject

Static data to send with the data request.

new CrudManager({
    // add static "foo" property to all requests data
    encoder : {
        requestData : {
            foo : 'Bar'
        }
    },
    ...
});

The above snippet will result adding "foo" property to all requests data:

    {
        "requestId"   : 756,
        "type"        : "load",

        "foo"         : "Bar",

        "stores"      : [
            ...

Properties

2
isJsonEncoder: Boolean= truereadonly
Identifies an object as an instance of JsonEncoder class, or subclass thereof.
isJsonEncoder: Boolean= truereadonlystatic
Identifies an object as an instance of JsonEncoder class, or subclass thereof.

Functions

2

Decodes (parses) a JSON response string to an object. If parsing fails, it returns null. Supposed to be overridden in case data provided by server has to be transformed into format requested by the Crud Manager.

ParameterTypeDescription
responseTextString

The response text to decode.

Returns: Object -

The decoded response.

Encodes a request object to JSON encoded string. If encoding fails (due to circular structure), it returns null. Supposed to be overridden in case data provided by the Crud Manager has to be transformed into format requested by server.

ParameterTypeDescription
requestDataObject

The request to encode.

Returns: String -

The encoded request.