Skip to content

Despatch Advice

Despatch Advice -> (layer: 'transaction', label: 'despatchAdvice')

GS1 to JSON mapping

This section shows the GS1 XML to JSON mappings. JSON keys are on the left, and the XPaths to the corresponding tag in GS1 XML are on the right, separated by a colon character (:).

// Context Node: /despatch_advice/despatachAdviceMessage
{
  "transactionID" : "despatchAdviceIdentification/entityIdentification",
  "creationDateTime" : "creationDateTime",
  "documentStatusCode" : "documentStatusCode",
  "contentOwnerGLN": "contentOwner/gln",
  "receiverGLN": "receiver/gln",
  "shipperGLN": "shipper/gln",
  "shipFromGLN": "shipFrom/gln",
  "shipToGLN": "shipTo/gln",
  "purchaseOrderID": "purchaseOrder/entityIdentification",
  "despatchInformation": {
    "actualShipDateTime": "despatchInformation/actualShipDateTime"
  },
  // Context Node: despatchAdviceLogisticUnit
  "despatchAdviceLogisticUnit" : [
    {
      "packageTypeCode": "packageTypeCode",
      "logisticUnitIdentification": {
        "unitType": "name(logisticUnitIdentification/*[1])",
        "unitID": "logisticUnitIdentification/*[1]"
      },
      // Context Node: despatchAdviceLineItem
      "despatchAdviceLineItem": [
        {
          "lineItemNumber": "lineItemNumber",
          "countryOfOrigin": "countryOfOrigin",
          "despatchedQuantity": "despatchedQuantity",
          "despatchedQuantityMeasurementUnitCode": "despatchedQuantity/@MeasurementUnitCode",
          "transactionalTradeItemGTIN": "transactionalTradeItem/gtin",
          "requestedItemGTIN": "requestedItemIdentification/gtin",
          "purchaseOrder": {
            "purchaseOrderID": "purchaseOrder/entityIdentification",
            "lineItemNumber": "purchaseOrder/lineItemNumber"
          }
        }
      ]
    }
  ],
  "flatEPCList" : [
    "despatchAdviceLogisticUnit/logisticUnitIdentification/*[1]",
    "despatchAdviceLogisticUnit/despatchAdviceLineItem/transactionalTradeItemGTIN/gtin",
    ...
  ]
}

Input

The following example shows a valid GS1 XML file for input. The JSON output follows.

Note: The following fields have been removed for GDPR compliance:

  1. StandardBusinessDocumentHeader.Sender.ContactInformation (all sub-elements)
  2. StandardBusinessDocumentHeader.Receiver.ContactInformation (all sub-elements)
<?xml version="1.0" encoding="UTF-8"?>
<despatch_advice:despatchAdviceMessage
    xmlns:despatch_advice="urn:gs1:ecom:despatch_advice:xsd:3"
    xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:gs1:ecom:despatch_advice:xsd:3 ../Schemas/gs1/ecom/DespatchAdvice.xsd">
    <sh:StandardBusinessDocumentHeader>
        <sh:HeaderVersion>1.0</sh:HeaderVersion>
        <sh:Sender>
            <sh:Identifier Authority="GS1"/>
        </sh:Sender>
        <sh:Receiver>
            <sh:Identifier Authority="GS1"/>
        </sh:Receiver>
        <sh:DocumentIdentification>
            <sh:Standard>GS1</sh:Standard>
            <sh:TypeVersion>3.3</sh:TypeVersion>
            <sh:InstanceIdentifier>string</sh:InstanceIdentifier>
            <sh:Type>despatchAdvice</sh:Type>
            <sh:MultipleType>false</sh:MultipleType>
            <sh:CreationDateAndTime>2006-01-10T12:00:01.000-05:00</sh:CreationDateAndTime>
        </sh:DocumentIdentification>
    </sh:StandardBusinessDocumentHeader>
    <despatchAdvice>
        <creationDateTime>2011-04-10T10:00:00.000-05:00</creationDateTime>
        <documentStatusCode>ORIGINAL</documentStatusCode>
        <despatchAdviceIdentification>
            <entityIdentification>string</entityIdentification>
        </despatchAdviceIdentification>
        <receiver>
            <gln>string</gln>
        </receiver>
        <shipper>
            <gln>string</gln>
        </shipper>
        <shipTo>
            <gln>string</gln>
        </shipTo>
        <despatchInformation>
            <actualShipDateTime>2011-04-10T10:15:00.000-05:00</actualShipDateTime>
        </despatchInformation>
        <purchaseOrder>
            <entityIdentification>string</entityIdentification>
        </purchaseOrder>
        <despatchAdviceLogisticUnit>
            <packageTypeCode>PE (pallet, modular)</packageTypeCode>
            <logisticUnitIdentification>
                <sscc>string</sscc>
            </logisticUnitIdentification>
            <despatchAdviceLineItem>
                <lineItemNumber>1</lineItemNumber>
                <despatchedQuantity>48</despatchedQuantity>
                <countryOfOrigin>DE</countryOfOrigin>
                <transactionalTradeItem>
                    <gtin>string</gtin>
                    <additionalTradeItemIdentification additionalTradeItemIdentificationTypeCode="XYZ1">
                    </additionalTradeItemIdentification>
                    <additionalTradeItemIdentification additionalTradeItemIdentificationTypeCode="XYZ2">
                    </additionalTradeItemIdentification>
                </transactionalTradeItem>
                <requestedItemIdentification>
                    <gtin>string</gtin>
                </requestedItemIdentification>
                <purchaseOrder>
                    <entityIdentification>string</entityIdentification>
                    <lineItemNumber>1</lineItemNumber>
                </purchaseOrder>
            </despatchAdviceLineItem>
        </despatchAdviceLogisticUnit>
        <despatchAdviceLogisticUnit>
            <packageTypeCode>PE</packageTypeCode>
            <logisticUnitIdentification>
                <sscc>string</sscc>
            </logisticUnitIdentification>
            <despatchAdviceLineItem>
                <lineItemNumber>2</lineItemNumber>
                <despatchedQuantity>24</despatchedQuantity>
                <countryOfOrigin>DE</countryOfOrigin>
                <transactionalTradeItem>
                    <gtin>string</gtin>
                    <additionalTradeItemIdentification additionalTradeItemIdentificationTypeCode="ABC1">
                    </additionalTradeItemIdentification>
                    <additionalTradeItemIdentification additionalTradeItemIdentificationTypeCode="ABC2">
                    </additionalTradeItemIdentification>
                </transactionalTradeItem>
                <requestedItemIdentification>
                    <gtin>string</gtin>
                </requestedItemIdentification>
                <purchaseOrder>
                    <entityIdentification>string</entityIdentification>
                    <lineItemNumber>2</lineItemNumber>
                </purchaseOrder>
            </despatchAdviceLineItem>
        </despatchAdviceLogisticUnit>
    </despatchAdvice>
</despatch_advice:despatchAdviceMessage>

Output

The following example shows the JSON output from the input GS1 XML file above.

This is the generated ID:


{
  "id": "urn:transaction:despatchAdvice:security_disabled:default:default:string"
}

This is the generated JSON:

{
  "creationDateTime": "2011-04-10T10:00:00.000-05:00",
  "documentStatusCode": "ORIGINAL",
  "transactionID": "string",
  "receiverGLN": "string",
  "shipperGLN": "string",
  "shipToGLN": "string",
  "despatchInformation": {
    "actualShipDateTime": "2011-04-10T10:15:00.000-05:00"
  },
  "purchaseOrderID": "string",
  "despatchAdviceLogisticUnit": [
    {
      "packageTypeCode": "PE (pallet, modular)",
      "logisticUnitIdentification": {
        "unitType": "sscc",
        "unitId": "string"
      },
      "despatchAdviceLineItem": [
        {
          "lineItemNumber": 1,
          "despatchedQuantity": 48,
          "countryOfOrigin": "DE",
          "transactionalTradeItemLGTINs": [
            "string"
          ],
          "requestedItemGTIN": "string",
          "purchaseOrder": {
            "purchaseOrderID": "string",
            "lineItemNumber": 1
          }
        }
      ]
    },
    {
      "packageTypeCode": "PE",
      "logisticUnitIdentification": {
        "unitType": "sscc",
        "unitId": "string"
      },
      "despatchAdviceLineItem": [
        {
          "lineItemNumber": 2,
          "despatchedQuantity": 24,
          "countryOfOrigin": "DE",
          "transactionalTradeItemLGTINs": [
            "string"
          ],
          "requestedItemGTIN": "string",
          "purchaseOrder": {
            "purchaseOrderID": "string",
            "lineItemNumber": 2
          }
        }
      ]
    }
  ],
  "flatEPCList" : [
    "string",
    "string",
    "string",
    "string"
  ]
}