Issue with creating json from object with BackboneElement

I am a newbie into FHIR and learning the ways of it.

I have created a custom class with a BackboneElement static class defined in it.
working scenario : Received data from parsed it into object - no issue.
failure scenario : when converting object to json, the object with BackboneElement class is getting skipped.

please suggest what could be wrong?

class A{
private StringType a;
@Block()
public static class B extends BackboneElement{
}
}

Why are you creating a custom class? You’re not allowed to define new backbone elements with FHIR if you want to be FHIR conformant. If you need to send additional data beyond what a resource definition allows, you have to use the extension elements

Is this using HAPI? If so, you might want to ask on the HAPI support forums

Yes its HAPI, and we found the resolution.

Thanks for responding to my query.