Hi All,
Does AEM provide a utility to convert Coral 3 multi-field node structure into a JSON format?
We have a requirement where we need to migrate our Legacy Coral 2 multi-field component to new Coral 3 structure that stores the data in node structure.
We do not want to change logic for reading the dialog data and hence want to know if there is already any per-written utility, which AEM provides to do this conversion.
Please suggest if any.
Regards,
Shikha
Solved! Go to Solution.
Hi,
Coral3 stores multi field in node structure.
You can simply access those nodes inside WCMUsePojo or Model and write a function which converts nodes data into JSON and return for further processing.
The idea is let AEM stores data in node structure but if you already have written your logic based on JSON, just put few lines of code to convert Node to JSON, if you are writing new logic then go ahead with node structure no need to convert.
Converting Node to JSOn at backend is super easy as compared to actual store values in json in node.
Hi,
Coral3 stores multi field in node structure.
You can simply access those nodes inside WCMUsePojo or Model and write a function which converts nodes data into JSON and return for further processing.
The idea is let AEM stores data in node structure but if you already have written your logic based on JSON, just put few lines of code to convert Node to JSON, if you are writing new logic then go ahead with node structure no need to convert.
Converting Node to JSOn at backend is super easy as compared to actual store values in json in node.
Hi,
I have almost similar problem. I have migrated coral 2 component to new coral 3. I want to convert existing multi-field Json data to nodes data.
Any help would be appreciated.
Thanks
Harpreet
Views
Replies
Total Likes
You can achieve this using sling models very easily-
@Model(adaptables=Resource.class)
public class MyModel {
@Inject
private List<Resource> addresses;
}
Here addresses the node name under which the multi-field nodes are getting saved
+- addresses
|
+- address1
|
+- address2
Refer:
I am not sure if this is going to solve the problem. I want to convert the actual data.
The scenario is, I had a coral 2 component and there are multi-fields saved in Json format. Now as coral 2 component is upgraded to coral 3, the new multi-field values are getting saved as nodes. The upgraded component is fine as long as new multi-fields values are saved and displayed. The problem is with the previous multi-field data stored in Json. Can I covert those multi-field Json data to nodes so that upgraded component can work well with both new and old multi-fields?
If you have any other suggestion to deal with existing Json format multi-field with coral 3 component.
Thanks
Views
Replies
Total Likes
The easiest way to handle existing JSON data for repopulating with coral3 type is converting json to nodes.
A script can search for all the multifield for a component type and create node structure from existing json.
Views
Replies
Total Likes
Views
Likes
Replies