0

I have a JBoss RestEasy - SPring - Hibernate integrated into an app.

My API call is like the following

@GET
@Path("/all")
public List<Foo> getAllFoos() {
    return fooService.getAllFoos();
}

My Foo class is Annotated like the following

@XmlRootElement
public class Foo {
    @XmlElement
    String test;
}

I am getting my JSON ouput as

[{"foo":{"test":"bill"}},{"foo":{"test":"monica}"}}]

I want to get

 [{"test":"bill"},{"test":"monica}"}]   

Thank you in advance. @peekskillet

Here are the dependencies related to rest easy

<dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>2.2.1.GA</version>
        </dependency>
        <!-- JBoss JAXB -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>2.2.1.GA</version>
        </dependency>
        <dependency>

        <!-- RestEasy Spring -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-spring</artifactId>
            <version>2.2.1.GA</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
            </exclusion>
            <exclusion>
                <artifactId>sjsxp</artifactId>
                <groupId>com.sun.xml.stream</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jsr250-api</artifactId>
                <groupId>javax.annotation</groupId>
            </exclusion>

            <exclusion>
                <artifactId>activation</artifactId>
                <groupId>javax.activation</groupId>
            </exclusion>
        </exclusions>
        </dependency>
Kamal Joshi
  • 498
  • 1
  • 7
  • 19
  • Can you post all your dependencies that are related to resteasy – Paul Samsotha Dec 27 '14 at 02:28
  • 1
    Depends on which JSON Serializer you are using. [This](http://stackoverflow.com/a/23157681) or [that](http://stackoverflow.com/a/20396007) might help. – lefloh Dec 27 '14 at 09:27
  • Thank you pointing me in the right direction. I added Jackson dependency my pom.xml and it worked as I wanted it to. org.jboss.resteasy resteasy-jackson-provider 2.2.1.GA – Kamal Joshi Dec 28 '14 at 03:17

0 Answers0