Expand my Community achievements bar.

SOLVED

Possible Method to trim the json model generated in AEM SPA

Avatar

Level 3

Hello everyone ! 

We were trying to implement AEM SPA using react and consuming the model.json generated to display the data to another applications. While consuming the model.json there are some json data being coming up from the page level , which we need to trim and display only the components authored in the page. Any possible method for this approach ? 

 

Also for example if we check the json response for the text component 

akashkriz005_0-1676883296215.png

 

Is it possible to edit  " :type: "  to type , without the semicolon ? Or is this a default configuration ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Interesting question,

I am also working on JSON generated SPA model. so there are two ways -

1. I was able to ignore it using below code in class level.

@JsonIgnoreProperties(":type")

and create a property called type and inside the getter of type just return the resourceType of model class.

2. Override the getExportedType() in your model class.

@Override
@JsonProperty("type")
public String getExportedType() {}

some more annotation if you wanna try:

https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations

 

Cheers!

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Interesting question,

I am also working on JSON generated SPA model. so there are two ways -

1. I was able to ignore it using below code in class level.

@JsonIgnoreProperties(":type")

and create a property called type and inside the getter of type just return the resourceType of model class.

2. Override the getExportedType() in your model class.

@Override
@JsonProperty("type")
public String getExportedType() {}

some more annotation if you wanna try:

https://github.com/FasterXML/jackson-annotations/wiki/Jackson-Annotations

 

Cheers!