Trigger a JSON layout rendering
SXA enables you to model your data in JSON (JavaScript Object Notation). For example, if you want to build a mobile app and feed it with SXA content, you can edit the JSON content on the page and have output content in JSON instead of HTML.
To trigger JSON output, you can:
-
Trigger JSON output using
device id.You can include the device id in the URL. Usesc_deviceto change the device in which the website is displayed. You can use the device name or the device id. For example, if you have a JSON layout defined for this page:http://sxa18//json-contentModify it by adding the
sc_devicequery string:http://sxa18//json-content?sc_device={0B4A31C9-712D-4578-A396-2DDC0F34B63A}or
http://sxa18/json-content?sc_device=json -
Trigger a device change with HTTP headers using
HTTP header.Set theapplication/jsonvalue for theContentTypeheader. For example, invoke with Powershell:Invoke-WebRequest "http://sxa18//json-content" -ContentType "application/json"