问题描述
在我的Adobe AEM项目中,出现错误:Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
这是我的页面模型:
<!-- AEM page model -->
<Meta property="cq:pagemodel_root_url" content="/index.model.json" />
这是实际的JSON
index.model.json
{
"designPath": "/libs/settings/wcm/designs/default","language": "en","title": "client OCR React","cssClassNames": "page basicpage","lastModifiedDate": 1538639429650,":items": {
"root": {
"gridClassNames": "aem-Grid aem-Grid--12 aem-Grid--default--12","columnCount": 12,"allowedComponents": {
"applicable": false,"components": [
{
"path": "/content/client_ocr_react/us/en/home/jcr:content/root/wcm/foundation/components/responsivegrid","title": "Layout Container"
},{
"path": "/content/client_ocr_react/us/en/home/jcr:content/root/content/client_ocr_react/us/en/home//components/text","title": "Text"
}
]
},"columnClassNames": {
"responsivegrid": "aem-GridColumn aem-GridColumn--default--12"
},":items": {
"responsivegrid": {
"gridClassNames": "aem-Grid aem-Grid--12 aem-Grid--default--12","allowedComponents": {
"applicable": false,"components": [
{
"path": "/content/client_ocr_react/us/en/home/jcr:content/root/responsivegrid/wcm/foundation/components/responsivegrid","title": "Layout Container"
},{
"path": "/content/client_ocr_react/us/en/home/jcr:content/root/responsivegrid/client_ocr_react/components/text","title": "Text"
}
]
},"columnClassNames": {
"text": "aem-GridColumn aem-GridColumn--default--12"
},":items": {
"text": {
"text": "<p>Hello World!</p>","richText": true,":type": "client_ocr_react/components/text"
}
},":itemsOrder": ["text"],":type": "wcm/foundation/components/responsivegrid"
}
},":itemsOrder": ["responsivegrid"],":type": "wcm/foundation/components/responsivegrid"
}
},":path": "/content/enel_ocr_react/us/en/home",":hierarchyType": "page",":type": "enel_ocr_react/components/page",":itemsOrder": ["root"]
}
我已经通过验证器运行了JSON,并且返回了有效信息。 在“网络”标签中查看,该数据返回index.model.json的200:
Request URL: http://localhost:3000/index.model.json
Request Method: GET
Status Code: 200 OK
Remote Address: 127.0.0.1:3000
但是,我确实注意到下面两行,其中有Request URL: http://localhost:3000/.model.json
,如果我尝试转到该路由,它将返回主页(没有JSON),但状态仍然为200。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)