Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Need to get etc/tags/xyz as json which contains only jcr:title property.

1 Accepted Solution
smacdonald2008
Correct answer by
Level 10
Level 10

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. 

View solution in original post

4 Replies
sureshy2015
Level 4
Level 4

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.

smacdonald2008
Correct answer by
Level 10
Level 10

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. 

View solution in original post