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

How to where to store JSON files to access JSON as it is in UI(Headless arch)

Avatar

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
umamaheswariy46
Level 3

05-06-2018

Hi Team,

We have a situation where we need to store the .JSON files as it is in same path and UI application is going to access this file. This is headless architecture.

What is the best place to keep this and that place should be accessible to team members and they can be able to upload it to the AEM like assets.

Any suggestions or ideas on this?

Thanks

Uma

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,198 likes

Total Posts

6,369 posts

Correct Reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile

Avatar
Establish
Community Manager
kautuk_sahni
Community Manager

Likes

1,198 likes

Total Posts

6,369 posts

Correct Reply

1,147 solutions
Top badges earned
Establish
Coach
Originator
Contributor 2
Contributor
View profile
kautuk_sahni
Community Manager

06-06-2018

Write a custom AEM service and then use JCR API to update the nodes.

Parse the values from JSON and then use API to update the nodes in the JCR -- for example:

//Store content from the client JSP in the JCR

   Node custNode = customerRoot.addNode("customer"+firstName+lastName+custId,"nt:unstructured");

              

  //make sure name of node is unique

  custNode.setProperty("id", custId);

  custNode.setProperty("firstName", firstName);

  custNode.setProperty("lastName", lastName);

See: Adobe Experience Manager Help | Persisting Adobe Experience Manager data in the Java Content Reposit... and Adobe Experience Manager Help | Submitting Adobe Experience Manager form data to Java Sling Servlets

If the Json data is huge then There are many libraries for serializing/deserializing JSON in java, the most notable is Google’s Gson: https://github.com/google/gson

Answers (5)

Answers (5)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,133 likes

Total Posts

3,161 posts

Correct Reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,133 likes

Total Posts

3,161 posts

Correct Reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

06-06-2018

Hi,

  • I have a file called tree.json on my local drive
  • I open my AEM 6.4 instance and browse into assets, /content/dam/we-retail
  • I drag and drop the tree.json into the browser window, triggering the upload it
  • tree.json is now being displayed as asset
  • I hit localhost:4502/content/dam/we-retail/tree.json
  • It is downloading the JSON file and it can be displayed correctly.

I did not have any problems with that approach.

Jörg

Avatar

Avatar
Validate 1
Level 1
derrickm1745863
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
derrickm1745863
Level 1

Like

1 like

Total Posts

3 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
derrickm1745863
Level 1

19-11-2018

This could be because of the dispatcher configs allow  ".json"  extention to be accessible

Avatar

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
umamaheswariy46
Level 3

07-06-2018

I tried same way, somehow it didnt work for me, Let me try again. Thanks

Avatar

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile

Avatar
Validate 10
Level 3
umamaheswariy46
Level 3

Likes

12 likes

Total Posts

144 posts

Correct Reply

5 solutions
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 10
View profile
umamaheswariy46
Level 3

06-06-2018

Hi Jorg,

we are looking for that kind of option, where the team can go ahead and upload the JSON file and should be able to accessible in UI, I have uploaded and not able to read JSON from the publishers .. returning page not found.  This approach is working for txt and js but not JSON.

Is there any way that i can upload JSON into dam and can be able to read content of the file by accessing the URL ?

Thanks

Uma

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,133 likes

Total Posts

3,161 posts

Correct Reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,133 likes

Total Posts

3,161 posts

Correct Reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

06-06-2018

Why don't you upload the JSON file as asset (just as you would upload images) and deliver it as is?

Jörg