Alternative for deprecated JsonItemWriter



Hello everyone,

org.apache.commons.json.* has been deprecated since a long time and AEM has some better alternatives now. Since AEM 6.3, we are encouraged to use Gson or Jackson.

However, there has been no mention about JsonItemWriter and it's replacement. Can anyone please help me with the alternative for JsonItemWriter?

Accepted Solutions (1)

Accepted Solutions (1)




Hi @sareshpp9060331 ,


We have been extensively using this class 


for json Serialization and Deserialization. This makes the code really short and clean and easy to understand.

You can refer to some examples here

You also have the option to exclude any property from json by marking it as transient like this:

public class Flags {

private String flagText;
private String flagColor;
private transient String SourcePath;

It will generate:

"Flags": {"flagText": "United Kingdom","flagColor": "511E62"},