How to make infinity.json or model.tidy.json work in publish instance? | Adobe Higher Education
Skip to main content
Level 3
June 18, 2023
Beantwortet

How to make infinity.json or model.tidy.json work in publish instance?

  • June 18, 2023
  • 6 Antworten
  • 3757 Ansichten

I want to get the content of a page as json and I want to consume that from an external application. When I tried in author, it works. But it doesn't work in publish instance. Please help on how to make it work on publish instance.

Thanks.

Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von joerghoh

This should be avoided on publish, because it exposes all JCR properties (including cq:lastModifiedBy properties, which can contain usernames/email addresses). Instead you should define Sling Models and use the Sling Model Exporter to make it available as JSON.

6 Antworten

MayurSatav
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 18, 2023
Kishore_Kumar_
Level 9
June 18, 2023

hi @rakesh_h2 ,

Please check in dispatcher filters if model.json is allowed. For eg like below

 

# Allow components JSON model
/0101 { /type "allow" /extension "json" /selectors "model" /path "/content/*" }

joerghoh
Adobe Employee
joerghohAdobe EmployeeAntwort
Adobe Employee
June 18, 2023

This should be avoided on publish, because it exposes all JCR properties (including cq:lastModifiedBy properties, which can contain usernames/email addresses). Instead you should define Sling Models and use the Sling Model Exporter to make it available as JSON.

Tanika02
Level 7
June 18, 2023

Hello @rakesh_h2 

 

Can you share the publisher logs to understand what happens when you are trying to access the content of a page as json in publisher?

santhosh_kumark
Level 6
June 18, 2023

Hi @rakesh_h2 
To expose the pages content as json, use sling model exporters which implements component exporter to expose data as json and allow them in the dispatcher rules.
To expose specific page content as json write a servlet as provided in the link (http://www.nateyolles.com/blog/2015/12/converting-aem-sling-resources-to-json) by excluding OOTB JCR properties and allow the servlet path in dispatcher.

TarunKumar
Community Advisor
Community Advisor
June 19, 2023

Hi @rakesh_h2 ,

For publisher model.json is restricted to access from dispatcher end. If you want to access the json then add Sling Model Exporter in your model class for the component whichever you are using in your page, also for accessing the page properties data you can add the exporter in your page model class.