Show/Hide Toolbars

TMS XData Documentation

Navigation: JSON Format

Entity and Object Representation

Scroll Prev Top Next More

Any entity or simple object is serialized as a JSON object. Each property is represented as a name/value pair within the object.

 

The name of the properties in JSON for an entity will be the same as property names defined in the Entity Model.

The name of the properties in JSON for a simple object will be the field names of the object class, with the leading "F" removed from the name, if it exists.

 

An entity in a payload may be a complete entity, with all existing properties for that entity type, or a partial entity update (for partial update operations), which do not list all properties of the entity.

An object in payload will always have all properties.

 

The following text illustrates how XData represents a simple Customer entity (TCustomer class).

 

{
  "$id": 1,
  "@xdata.type": "XData.Default.Customer",
  "Id": 55,
  "Name": "Joseph",
  "Birthday": "1980-05-20",
  "Sex": "tsMale",
  "Picture": null
}

 

In above JSON representation, Customer entity type contains simple properties Id (integer), Name (string), Birthday (date), Sex (enumeration) and Picture (blob). The property values are represented as direct JSON values. Note that XData also includes some metadata information in the JSON object, like "$id" name which represents the object reference id, and the "xdata.type" annotation which is needed for it to work properly. The following topics describe more specific details about how entities and its properties are represented in XData.

 

Property Values

Object References

Annotation "xdata.type"

Representing Associated Entities

Blob Representation

Including or Excluding Properties