CXF's JsonProvider not displaying subclass element

Solution Verified - Updated -


  • We are using default JSONProvider from JBoss Fuse 6.2.1 for our rest API to construct our the JSON output. However, the output format is unexpected.
    • It automatically convert a String to int (e.g. Expected: {"terminal":"1"}. The actual output: {"terminal":1})
    • It simply output the parameters from base class, and ignore the content from subclass. E.g.
class Base {
    String terminal;
    //get & set...
class Sub extends Base {
    String otherInfo;
    //get & set...

Base b = new Sub();

The expected output will be {"terminal":"1", "otherInfo":"abc"}.
While the actual output is {"terminal":1}.

  • The configuration in Blueprint file is as following:

    <bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
    <property name="dropRootElement" value="true"></property>
    <property name="supportUnwrapped" value="true"></property>
    <property name="ignoreNamespaces" value="true"></property>


  • Red Hat JBoss Fuse
    • 6.2.1
    • 6.3.x
  • Apache CXF

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.