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?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @sareshpp9060331 ,
We have been extensively using this class
import com.google.gson.annotations
for json Serialization and Deserialization. This makes the code really short and clean and easy to understand.
You can refer to some examples here http://websystique.com/java/json/gson-json-annotations-example/
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"},
Hi @sareshpp9060331 ,
Please check the below blogs which talks about deprecation and it's alternatives.
http://www.sgaemsolutions.com/2017/08/alternatives-of-deprecated-json-api-in.html?m=1
Hi @sareshpp9060331 ,
We have been extensively using this class
import com.google.gson.annotations
for json Serialization and Deserialization. This makes the code really short and clean and easy to understand.
You can refer to some examples here http://websystique.com/java/json/gson-json-annotations-example/
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"},
Views
Likes
Replies
Views
Like
Replies