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

Read the Node data in json format

Avatar

Avatar
Validate 1
Level 2
shashanks526115
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 3
Give Back
Boost 1
View profile

Avatar
Validate 1
Level 2
shashanks526115
Level 2

Like

1 like

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 3
Give Back
Boost 1
View profile
shashanks526115
Level 2

24-06-2019

Hello,

        I am shashank singh. I am trying to read the node properties in json formate but i am getting the error message.. so is there any way to read the node property from dam path in json format.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

24-06-2019

Hi,

You can read it using google gson API.

e.g. read node properties as ValueMap and convert this object into json using gson.toJson(valueMapObj)

Example, if you are doing this in servlet

Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();

ValueMap valueMap = req.getResourceResolver().getResource("/content/we-retail/jcr:content").getValueMap();

String jsonStr = gson.toJson(valueMapObj)

Note: for jcr:data or other binary type property can't be exposed in JSON, so remove from valueMap before converting to json.

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
Gaurav-Behl
MVP

Likes

248 likes

Total Posts

1,147 posts

Correct Reply

283 solutions
Top badges earned
Establish
Give back 300
Give Back 50
Give Back 5
Give Back 3
View profile
Gaurav-Behl
MVP

24-06-2019

Did you get a chance to go through Assets HTTP API  or Content Fragments Support in AEM Assets HTTP API since your requirements use DAM path?

You could even use custom exporter based on the complexity of your use case.