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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to save a JSON property in multifield in JSON rather than in Nodes

abhisheks144250
Level 2
Level 2

Hi,
I have a multifield in AEM 6.4(referring

granite/ui/components/coral/foundation/form/multifield).

I want to save a JSON property as "Items"  : {"language":"/content/languages/english","textText":"temp","emptytext":"jkjkjkjk"}
By default in aem 6.4 its storing these as nodes, which will lead me to a code change at many places.
Any way round there so that it still stores in JSON format instead of nodes.

Note:  already tried

acs-commons-nested="JSON_STORE" but not working in 6.4.

acs-commons-nested="JSON_STORE"

4 Replies
Arun_Patidar
Community Advisor
Community Advisor

Hi,

ACS Common Multifield does not work with coral3/Granite components. you can try with coral2 multifield.

Granite- /libs/granite/ui/components/coral/foundation/form/multifield

Coral2 - /libs/granite/ui/components/foundation/form/multifield

smacdonald2008
Level 10
Level 10

As Arun states - to save as JSON - you have to use granite and ACS-Commons.

For granite/coral MF (granite/ui/components/coral/foundation/form/multifield) -  it's saved as nodes as discussed here - Building Experience Manager Components using Granite/Coral Resource Types

I am always curious when i see questions like this. Why does it matter where these granite types store the data in the JCR. The purpose is for the data to be present when you open the component dialog (the data appears in the dialog) and when you update the component dialog.

Unless you want to read this data for a custom solution (other then a component and its dialog) - should be no reason to care if the data is stored as nodes or JSON.

abhisheks144250
Level 2
Level 2

Thats correct, but we are migrating from 6.1 to 6.4. This will require a lot of code change i guess in the project i am working.

Arun_Patidar
Community Advisor
Community Advisor

In this case you can write an utility which simply read multifield nodes and return as JSON. Though this will also require small code change in your existing code.