Table of Contents

JSON Format V1

JSON based data storage is used to persist data into a text (JSON) format. In 2sxc 9.4 we introduced it to store entities in the history (for version rollback). Since then it has found many new applications.

JSON Package

The Json format has a minimal header like this:

{
  "_": { "V": 1 }
}

which just contains the version. Future non-breaking enhancements will leave the version on 1 and optionally add more header information.

In addition to that, the basic package can contain

  1. ContentType node
  2. an Entity node
  3. a Query - which is actually also an Entity with lots of Metadata
  4. a View - which is an Entity with Metadata and Assets

This could then look like this:

{
  "_": { "V": 1 },
  "ContentType": {
    "Id": "|Config ToSic.Eav.DataSources.SqlDataSource",
    "Name": "|Config ToSic.Eav.DataSources.SqlDataSource",
    ...
  }
}

Special Stuff about the JSON Format

All values have language information

As we're usually working with real-life content-items, multi-language is always a concern. Because of this, every value is multi-language by default. If the language code is *, that means that this value is the default/fallback value for all languages. See JSON Value (Multilanguage) V1

Metadata is a Recursive List of Entities

2sxc and the EAV is all about real-life content-management. As such, many pieces of information have more information attached, called Metadata. Metadata-items could themselves have their own Metadata, which is then of course attached as well. See JSON Metadata V1

Limitations

As of now (2sxc 9.7) such a package can only contain 1 root item (a content-type or an entity). Future versions may enhance this.

Read also

History

  1. Added in v9.4
  2. Enhanced with Content-Types in v9.7
  3. Extended to support attachments so Views can include templates and icons in 2sxc ca. v11.10