we are working on implementing amp pages for our site.We are using AEM cms,we followed the selector approach to identify the amp specefic resource scripts to render the content But while using json data and amp-list we are getting Status Code:302 Found and error in console Error fetching amp-list: Unexpected token < in JSON at position 1
We tried using the same samples given in amp documentation and still ending up with the same exception
Note : While directly hitting the JSON from browser we are getting the response. I have added the required scripts for amp-list and template in header part
Any thoughts/suggestions will be of great help
Code snippets
Amp Page for the component
<amp-list width="auto"
height="100"
layout="fixed-height"
src="http://localhost:4502/xxxxx/results.json"
<template type="amp-mustache"
id="amp-template-id">
<li>
<a href={{url}}>{{title}}</a>
</li>
</template>
</amp-list>
results.json
{
"items": [
{
"title": "amp-carousel",
"url": "https://ampbyexample.com/components/amp-carousel"
},
{
"title": "amp-img",
"url": "https://ampbyexample.com/components/amp-img"
},
{
"title": "amp-ad",
"url": "https://ampbyexample.com/components/amp-ad"
},
{
"title": "amp-accordion",
"url": "https://ampbyexample.com/components/amp-accordion"
}
]
}
<
character, there's a good chance you're getting an HTML response instead of a JSON for some reason. Check what the response body and the status code are. – toniedzwiedz