Expand my Community achievements bar.

SOLVED

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

Avatar

Level 4

 please help me regarding the same.

1 Accepted Solution

Avatar

Correct answer by
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

Avatar

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.

Avatar

Correct answer by
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.