How to ignore(/hide) attributes of class in JSON response
<p>I am new to Java RESTful web services. I have classes structure as following: </p>

<pre><code>    class BaseClass{
        String basicInfo; 
    }

    class DataClass extends BaseClass{
        String id;  
    }   

    class DataList extends BaseClass{
        List&lt;DataClass&gt; dataList;
    }
</code></pre>

<p>when I get DataList class as Response of web-service, I get it in following format:</p>

<pre><code>    {
        "basicInfo" : "Mandetory",
        "dataList"  : [
                {
                    "basicInfo" : "Optional",
                    "id" : "I_1001"                 
                },
                {
                    "basicInfo" : "Mandetory",
                    "id" : "I_1002"
                }
        ]

    }
</code></pre>

<p>But I want to ignore "basicInfo" attribute in every Data Object of dataList.</p>

<p>ex. </p>

<pre><code>{
        "basicInfo" : "Mandetory",
        "dataList"  : [
                {
                    "id" : "I_1001"                 
                },
                {
                    "id" : "I_1002"
                }
        ]

    }
</code></pre>

<p>Is there any way through which I could ignore these attributes(using annotations)? </p>

<p>Note : I can't change the class structures. </p>