Memorynotfound Java Programming Tutorials

json tutorials

GSON Format Date in JSON object

You can globally specify how to format dates in JSON objects using GSON. Very easy, you will only have to declare your custom date once. GSON Format Date method setDateFormat() witch takes an int...
json tutorials

Excluding field from JSON with @Expose GSON

GSON provides a way where you can mark certain fields of your objects to be excluded for consideration for serialization and deserialization to JSON. To use this @Expose GSON annotation, you must create Gson...
json tutorials

Custom JSON field naming using GSON

Gson supports custom naming for JSON fields. You can annotate your fields with @SerializedName to provide this functionality. If there is an error in the naming of the field, it’ll throw a Runtime exception....
json tutorials

Deserialise JSON to Java Object using GSON

Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can...
json tutorials

Serialise Java Object to JSON using GSON

Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can...
xml tutorials

Convert XML to Polymorphic Object using JAX-B

Here is an example of how you can convert XML to polymorphic objects using JAX-B. Abstract Animal Class package com.memorynotfound.xml.jaxb; public abstract class Animal { } Cat Inherits from Animal package com.memorynotfound.xml.jaxb; import javax.xml.bind.annotation.XmlRootElement;...
xml tutorials

Convert Polymorphic Object to XML using JAX-B

When you use polymorphism in your classes and you want to convert your object to XML using JAX-B, here is an example how to. Abstract Animal Class package com.memorynotfound.xml.jaxb; public abstract class Animal {...