Module: odata/json

odata/json

Methods

<inner> addFullMetadataToJsonPayload(data, model, recognizeDates)

Add metadata to an JSON payload complex object containing full metadata
Parameters:
Name Type Description
data Object Data structure to be extended
model Object Metadata model
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

<inner> addMetadataToJsonMinimalPayloadCollection(data, model, collectionInfo, baseURI, recognizeDates)

Add metadata to an JSON payload collection object containing minimal metadata
Parameters:
Name Type Description
data Object Data structure to be extended
model Object Metadata model
collectionInfo String Information about the data (name,type,typename,...)
baseURI String Base Url
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

<inner> addMetadataToJsonMinimalPayloadComplex(data, property, baseURI, model, recognizeDates)

Add metadata to an JSON payload complex object containing minimal metadata
Parameters:
Name Type Description
data Object Data structure to be extended
property String Information about the data (name,type,typename,...)
baseURI String Base Url
model Object Metadata model
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

<inner> addMetadataToJsonMinimalPayloadEntity(data, objectInfo, baseURI, model, recognizeDates)

Add metadata to an JSON payload entity object containing minimal metadata
Parameters:
Name Type Description
data Object Data structure to be extended
objectInfo String Information about the data (name,type,typename,...)
baseURI String Base Url
model Object Metadata model
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

<inner> addMetadataToJsonMinimalPayloadFeed(data, model, feedInfo, baseURI, recognizeDates)

Add metadata to an JSON payload feed object containing minimal metadata
Parameters:
Name Type Description
data Object Data structure to be extended
model Object Metadata model
feedInfo String Information about the data (name,type,typename,...)
baseURI String Base Url
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

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

Add metadata to an JSON payload object containing minimal metadata
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

<inner> addType(data, name, value)

Add an OData type tag to an JSON payload object
Parameters:
Name Type Description
data Object Data structure to be extended
name String Name of the property whose type is set
value String Type name
Source:

<inner> addTypeColNoEdm(data, name, typeName)

Add an OData type tag to an JSON payload object collection (without "Edm." namespace)
Parameters:
Name Type Description
data Object Data structure to be extended
name String Name of the property whose type is set
typeName String Type name
Source:

<inner> addTypeNoEdm(data, name, value)

Add an OData type tag to an JSON payload object (without "Edm." namespace)
Parameters:
Name Type Description
data Object Data structure to be extended
name String Name of the property whose type is set
value String Type name
Source:

<inner> checkProperties(data, objectInfoType, baseURI, model, recognizeDates)

Loop through the properties of an JSON payload object, look up the type info of the property and call the appropriate add*MetadataToJsonPayloadObject function
Parameters:
Name Type Description
data Object Data structure to be extended
objectInfoType String Information about the data (name,type,typename,...)
baseURI String Base Url
model Object Metadata model
recognizeDates Boolean Flag indicating whether datetime literal strings should be converted to JavaScript Date objects.
Source:

<inner> convertDates(data, propertyName, type)

Convert the date/time format of an property from the JSON payload object (without "Edm." namespace)
Parameters:
Name Type Description
data Object Data structure to be extended
propertyName Name of the property to be changed
type Type
Source:

<inner> convertDatesNoEdm(data, propertyName, type)

Convert the date/time format of an property from the JSON payload object
Parameters:
Name Type Description
data Object Data structure to be extended
propertyName Name of the property to be changed
type Type
Source:

<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> formatJsonRequestPayload(data) → {String}

Convert OData objects for serialisation in to a new data structure
Parameters:
Name Type Description
data Data to serialize.
Source:
Returns:
The string representation of data.
Type
String

<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> formatRawLiteral(value, type) → {string}

convert raw byteArray to hexString if the property is an binary property
Parameters:
Name Type Description
value Value to be formatted.
type Edm type of the value
Source:
Returns:
Value after formatting
Type
string

<inner> isJsonSerializableProperty(attribute) → {boolean}

Determine form the attribute name if the attribute is a serializable property
Parameters:
Name Type Description
attribute
Source:
Returns:
Type
boolean

<inner> jsonGetEntryKey(data, data) → {string}

Gets the key of an entry.
Parameters:
Name Type Description
data Object JSON entry.
data Object EDM entity model for key loockup.
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, type) → {Object}

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

<inner> jsonParser(handler, text, context)

Extend JSON OData payload with metadata
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> jsonSerializer(handler, data, context) → {String}

Serializes a ODataJs payload structure to the wire format which can be send to the server
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(fragments, model) → {Object}

Creates an object containing information for the context
Parameters:
Name Type Description
fragments String Uri fragment
model Object Object describing an OData conceptual schema
Source:
Returns:
type(optional) object containing type information for entity- and complex-types ( null if a typeName is a primitive)
Type
Object

<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