I am developing a fairly simple AEM component, but I'm stuck understanding the best practice.
For example, let's say I want to store a set of Link
objects, each of which contains a href & title properties.
This can be stored in 2 ways:
[1] Each link as a separate node:
component
├── link_1
│ ├── .href = "#1"
│ └── .title = "T1"
└── link_2
├── .href = "#2"
└── .title = "T2"
[2] As a JSONArray property beneath component
:
component
└── .links = [{"href":"#1", "title":"T1"}, {"href":"#2", "title":"T2"}]
After writing this out, I think I answered my own question...
Even though Option [2] is appealing for component development, it seems redundant when JCR/Sling data modeling already provides that hierarchy.
Am I understanding this correctly?
I know it is possible to export a
Resource
as JSON, but is it possible to import/create aSyntheticResource
from JSON?- If not that, when would one use
SyntheticResource
- If not that, when would one use
- Would I be better off storing the
link
nodes beneath a separate a distinct parent node for organization?
component
└── links
├── link_1
│ ├── .href = "#1"
│ └── .title = "T1"
└── link_2
├── .href = "#2"
└── .title = "T2"