Need to get etc/tags/xyz as json which contains only jcr:title property. | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

If you want a servlet that returns JSON and only contains this property - write your own sling servlet and create app logic to get the properties that you want and encode the data to JSON. 

4 replies

sureshy2015
New Participant
October 16, 2015

currently i am getting this on hitting the url---http://localhost:4502/etc/tags/country.-1.json

{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"country","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag","india":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"india","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag","Delhi":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"Delhi","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag"},"Kolkata":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"Kolkata","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag"}},"Australia":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"Australia","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag","sydney":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"sydney","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag"},"Melbourne":{"jcr:description":"","sling:resourceType":"cq/tagging/components/tag","jcr:title":"Melbourne","jcr:createdBy":"admin","jcr:created":"Mon Jun 08 2015 10:43:04 GMT+0530","jcr:primaryType":"cq:Tag"}}}

 

 

I want each object to have only jcr:title property not other information like jcr:primary type,jcr:lastModified etc.

Employee
October 16, 2015
smacdonald2008
smacdonald2008Accepted solution
New Participant
October 16, 2015

If you want a servlet that returns JSON and only contains this property - write your own sling servlet and create app logic to get the properties that you want and encode the data to JSON. 

sureshy2015
New Participant
October 16, 2015

How to achieve this pls help.