Skip to main content
Some information does not fit into any field of the merchandise management system: technical data sheets for a product, shipping times per postcode, a menu tree, the response of a payment provider. The JSON interface brings such data to any place in the template, in a way that lets you use it there just like shop data. Typical applications:
  • additional product information, images and technical parameters
  • shipment tracking in the customer account
  • a complete main menu including submenus
  • top-seller structures and cross-links for categories or products
  • postcode lists with shipping times and Europe-wide public holidays for delivery time calculation
  • third-party reviews
  • content from a content management system
It works in both directions: the shop can not only read JSON data but also generate and modify it itself, in order to pass it on via AJAX, JavaScript or email. ASSE is suitable for sending data to external systems.

Where the data comes from

Activation and FTP access

Have the JSON interface activated for your shop. You will receive a dedicated FTP access with server, user name and password.
If you only want to work with internal data, i.e. with responses from external systems, you need neither activation nor a dedicated FTP access.

The folder structure

The root directory contains the files that apply to all shops and subshops. If a subshop is to get its own files, create a directory named with the subshop ID and place the files there.
The file name must be the same in all subshop directories. Which file is loaded depends on the subshop the visitor is currently in.
You are free to create further subdirectories.
Do not place more than 500 JSON files in one directory, as performance suffers beyond that. Distribute the files across subdirectories instead.

File requirements

The second name is invalid because it contains brackets and a dot. Correct:
A tag may be at most 128 characters long, and the access path is part of the tag. Therefore keep names short and hierarchies flat. With deeply nested data and long names, you will hit this limit.

The two tag families

The tags work on all templates. No adjustment of the shop.config is required.

Loading data

Data is loaded with EJD-LoadData(). The tag takes three values: the type, the path and an identifier.
You choose the identifier in the third field freely. All subsequent tags use it to access the loaded data. Several files can be loaded in parallel in one template, each with its own identifier.
At most 100 JSON files can be loaded at the same time.
Reference: EJD-LoadData()

Checking whether the data has arrived

Used as a single tag, the negative tag outputs the error code. This lets you distinguish whether the file is missing or does not contain valid JSON.
Reference: EJD-DataOK()

Accessing values

A value is addressed via its access path. This is made up of the names of the levels, joined by dots. Array elements get their index in square brackets, counted from zero. The top-level element is represented by an empty path or _root_. The following examples use this file:
In the template:
The file name itself can come from a tag. In the example, the file with the product number in its name is loaded for each product.
Reference: EJD-DA-Value()

Setting the identifier once

If only one file is used on the template, EJD-SetUseID() saves you from repeating the identifier in every tag.
EJD-DataOK() still needs the identifier. The default does not apply to this one tag.
Reference: EJD-SetUseID()

Reusing values in other tags

The EJD-DA- tags carry their values in brackets and therefore cannot simply be nested inside other tags. However, the shop remembers every value and every name that such a tag touches. Via EJD-LastValueAccessed and EJD-LastNameAccessed you can get at whatever was touched last, and this can be reused like any other value.
If a value should be remembered but not output, there are dedicated tags for that:
The access path can also be assembled in a free placeholder if the index comes from a loop:
Reference: EJD-DA-ArrayElements() · EJD-LastValueAccessed · EJD-LastNameAccessed · EJD-DA-TouchName() · EJD-DA-TouchValue() · EJD-DA-TouchArrayElements() · DC-ZeroLoop1…3 · DC-ZeroLoop1…3_set() · DC-ZeroLoop1…3_position

Setting decimal places

Reference: EJD-SetRealOutputFormat()

Checking elements

The type of a value can be queried. The value is remembered at the same time.
Available tags are EJD-DA-IsTrue(), EJD-DA-IsFalse(), EJD-DA-IsNull(), EJD-DA-IsNumber(), EJD-DA-IsReal(), EJD-DA-IsString(), EJD-DA-IsObject() and EJD-DA-IsArray(). Whether a name exists at all is answered by a dedicated tag. It remembers the name in the process.
The output is Crosslinks, i.e. the last part of the path, not the whole path.
Reference: EJD-DA-IsTrue() · EJD-DA-IsFalse() · EJD-DA-IsNull() · EJD-DA-IsNumber() · EJD-DA-IsObject() · EJD-DA-IsReal() · EJD-DA-IsString() · EJD-DA-IsArray() · EJD-DA-NameExists()

Iterating over elements

If you do not know the names of the elements in advance, EJD-ElementIterator() iterates over them. As a loop, the tag repeats the code; as a single tag, it outputs the name of the current element.
If an element is missing, the position stays empty, without an error. Where this is a problem, check beforehand with EJD-DA-NameExists().
Reference: EJD-ElementIterator()

Generating your own JSON data

The shop can also build JSON data itself or modify loaded data and then output it. Three rules apply:
  • If the element already exists under the specified path, it is overwritten.
  • If it does not exist yet, it is created.
  • Exactly one element can be edited per call.

Simple values

Arrays

An empty array is created and then extended position by position. Whether you alternate between extending and filling, or first create all positions and then fill them, is up to you.
If the array itself is to be the top level, the path is _root_.
Removing an element:

Nested data

Each level is first created as an empty object and then filled.

Checking whether the modification succeeded

The error state persists even if a later modification succeeds. Therefore reset it with EJD-ResetModificationOK; otherwise, from the first failed modification onwards, you will always be checking the same old error.
Reference: EJD-CreateNewData() · EJD-DA-SetStringValue() · EJD-DA-SetNumberValue() · EJD-DA-SetRealValue() · EJD-DA-SetToTrue() · EJD-DA-SetToFalse() · EJD-DA-SetToNull() · EJD-DA-SetToEmptyArray() · EJD-DA-SetToEmptyObject() · EJD-DA-ArrayExtend() · EJD-DA-DeleteElement() · EJD-RawDataOutput() · EJD-ModificationOK · EJD-ResetModificationOK

Processing data from external systems

Responses from payment providers, shipping service providers or the shop system itself are not available as files. They arrive at the moment of the call and are therefore called internal.
With files, you know what they contain because you uploaded them yourself. With internal data, this is often not the case. EJD-RawDataOutput() therefore outputs everything that has arrived. This is the fastest way to find out what you are dealing with.

Step 1: Passing the data to the interface

You can find out which name applies to your case from the respective service provider or from WEBSALE. If the data arrives hex-encoded, use EJD-SetRawDataHexCodedInput() instead.

Step 2: Loading and assigning an identifier

For internal data, the second parameter is not a path but a technical name that depends on the use case.
Some internal data comes directly from the shop system and does not need step 1. The hreflang information, for example, can be loaded directly:
Everything else, i.e. checking, accessing individual values and output, works the same as with files. Reference: EJD-SetRawDataInput() · EJD-SetRawDataHexCodedInput() Guide: hreflang attribute
  • Use cases: JSON interface
  • Guide: Embedding external content
  • Guide: Exchanging data with external systems
  • Guide: DHL shipment tracking