Skip to main content

Automatic JSON-Feed of Instance Data for JavaScript, knockoutJS etc.

Warning ⚠️: New Docs Available

These are old docs and we haven't found the time to completely move them. You will find comprehensive new docs on

Introduced in Version 05.02.00

2sxc automatically serializes the modules data - IF you allow it to. 

To experience this feature:

  1. go to the settings of a Template/View
    note: in 2sxc 5 & 6 this was a module-setting
  2. enable the check-box
  3. tell the system which streams you want to publish (usually "Default" and maybe some more)
  4. then start writing your JavaScript

Note: the automatic system creates JSON but not JSON-P. This is a security feature. 

Accessing the Data from JavaScript

Using this data in JavaScript is provided using the $2sxc(...).data object. Your code would usually look a bit like this:

// Load the data from the 2sxc module and define a callback
$2sxc(moduleId).data.on("load", function (source, data) {
    // your custom code here

Note that there are a few things that are a bit unique about this, which I'll explain a bit more.

Deprecated Features

Enabling this JSON Publication in Code

This is almost never necessary, but there may be situations where you want to selectively enable/disable the JSON publication (new in v.6, unimportant since 8.0). The code would look as follows:

@using System.Data

@using ToSic.Eav.DataSources



       // Official place to provide data preparation. Is automatically called by 2sxc

       public override void CustomizeData()


             // enable publishing

             Data.Publish.Enabled = true;

             Data.Publish.Streams = "Default,UIResources";





  1. Feature added in 5.2.0
  2. Added ability to specific which streams in 6.0.6 (before you couldn't edit that field)
  3. Added ability to override these settings in the razor backend in 6.0.6
  4. Modified URL-Schema in 8.0 to improve performance and not run requests through DNN-pages. The JS access stayed the same, through the $2sxc object. 
Tags for this feature
JavaScript Design Lists

Demo using a 2SexyContent List

Below you'll find a module showing a list of employees. The module has Publish Data activated, allowing us to publish the data as JSON. Try the link:


Charlie Brown

Chief Cartoon Manager

Coral Bay
33304 Fort Lauderdale

+41 00 000 00 00

> vCard
> Routenplaner

Daniel Mettler


Churerstrasse 35
9470 Buchs SG

+41 12 345 67 89

> vCard
> Routenplaner

Raphael Müller


Churerstrasse 35
9470 Buchs

+41 81 123 45 67

> vCard
> Routenplaner