EDIT:
This seems to be a bug in Jettison. org.apache.cxf.jaxrs.provider.json.JSONProvider uses Jettison which caused this issue. If you use Jackson provider, then this issue is no longer there.
Add the following to beans.xml under jaxrs:server.
<jaxrs:providers>
<ref bean="jacksonProvider" />
</jaxrs:providers>
.
And, the following directly as a child of root.
<bean id="jacksonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider">
</bean>
As per the JSON Specification, numbers are allowed as values. An excerpt from it says,
2.1. Values
A JSON value MUST be an object, array, number, or string, or one of
the following three literal names:
false null true
Here's an example that is mentioned in the spec.
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": "100"
},
"IDs": [116, 943, 234, 38793]
}
}
If you actually want a String, then you probably look at your resource class, and relevant bean class to make sure the field types are correct!