Module: odata/json

odata/json

Methods

<inner> createPayloadInfo(data, model)

Infers the information describing the JSON payload from its metadata annotation, structure, and data model.
Parameters:
Name Type Description
data Object Json response payload object.
model Object Object describing an OData conceptual schema. If the arguments passed to the function don't convey enough information about the payload to determine without doubt that the payload is a feed then it will try to use the payload object structure instead. If the payload looks like a feed (has value property that is an array or non-primitive values) then the function will report its kind as PAYLOADTYPE_FEED unless the inferFeedAsComplexType flag is set to true. This flag comes from the user request and allows the user to control how the library behaves with an ambigous JSON payload.
Source:
Returns:
Object with kind and type fields. Null if there is no metadata annotation or the payload info cannot be obtained..

<inner> formatLiteral(value, type) → {string}

Formats a value according to Uri literal format
Parameters:
Name Type Description
value Value to be formatted.
type Edm type of the value
Source:
Returns:
Value after formatting
Type
string

<inner> jsonGetEntryKey(data) → {string}

Gets the key of an entry.
Parameters:
Name Type Description
data Object JSON entry.
Source:
Returns:
Entry instance key.
Type
string

<inner> jsonIsPrimitiveType(typeName) → {Boolean}

Determines whether a type name is a primitive type in a JSON payload.
Parameters:
Name Type Description
typeName String Type name to test.
Source:
Returns:
True if the type name an EDM primitive type or an OData spatial type; false otherwise.
Type
Boolean

<inner> jsonMakePayloadInfo(kind, typeName) → {Object}

Creates an object containing information for the json payload.
Parameters:
Name Type Description
kind String JSON payload kind, one of the PAYLOADTYPE_XXX constant values.
typeName String Type name of the JSON payload.
Source:
Returns:
Object with kind and type fields.
Type
Object

<inner> jsonParser(handler, text, context)

Parses a JSON OData payload.
Parameters:
Name Type Description
handler This handler.
text Payload text (this parser also handles pre-parsed objects).
context Object Object with parsing context.
Source:
Returns:
An object representation of the OData payload.

<inner> jsonReplacer(value) → {String}

JSON replacer function for converting a value to its JSON representation.
Parameters:
Name Type Description
value Object Value to convert.
Source:
Returns:
JSON representation of the input value. This method is used during JSON serialization and invoked only by the JSON.stringify function. It should never be called directly.
Type
String

<inner> jsonSerializer(handler, data, context) → {String}

Serializes the data by returning its string representation.
Parameters:
Name Type Description
handler This handler.
data Data to serialize.
context Object Object with serialization context.
Source:
Returns:
The string representation of data.
Type
String

<inner> minutesToOffset(minutes) → {String}

Formats the given minutes into (+/-)hh:mm format.
Parameters:
Name Type Description
minutes Number Number of minutes to format.
Source:
Returns:
The minutes in (+/-)hh:mm format.
Type
String

<inner> parseContextUriFragment() → {Object}

Creates an object containing information for the context TODO check dou layout
Source:
Returns:
  • Object with type information
    Type
    Object
  • see constants starting with PAYLOADTYPE_
    Type
    Object.detectedPayloadKind(optional)
  • deltainformation, one of the following valus DELTATYPE_FEED | DELTATYPE_DELETED_ENTRY | DELTATYPE_LINK | DELTATYPE_DELETED_LINK
    Type
    Object.deltaKind(optional)
  • name of the type
    Type
    Object.typeName(optional)
  • object containing type information for entity- and complex-types ( null if a typeName is a primitive)
    Type
    Object.type(optional)

<inner> parseJsonDateString(value) → {Date}

Parses the JSON Date representation into a Date object.
Parameters:
Name Type Description
value String String value.
Source:
Returns:
A Date object if the value matches one; falsy otherwise.
Type
Date

<inner> readPayloadMinimal(data, model, recognizeDates) → {Object}

Processe a JSON response payload with metadata-minimal
Parameters:
Name Type Description
data Object Json response payload object
model Object Object describing an OData conceptual schema
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:
Returns:
Object in the library's representation.
Type
Object