Hi
You should be able to achieve that if you use the value="" attribute
rather than setting the value within the body of the <json:property>
tag.
So instead of
<json:property name="price">${product.price}</json:property>
try
<json:property name="price" value="${product.price}"/>
When you specify the value like this then the type returned by the EL
expression should be a Java numeric type (int, float) which in turn
will be treated as a JavaScript numeric value when rendering the JSON.
When specifying the value within the body of the tag any value is
always treated as a String.
Here is an example from the taglib test suite...
<%-- Primitive values test --%>
<json:object>
<json:property name="boolT" value="${true}"/>
<json:property name="boolF" value="${false}"/>
<json:property name="string1" value="true"/>
<json:property name="string2" value="false"/>
<json:property name="numeric1" value="${1+2}"/>
<json:property name="numeric2" value="${-500}"/>
<json:property name="numeric3" value="${123.456}"/>
</json:object>
<%-- Expected
{
"boolT":true,
"boolF":false,
"string1":"true",
"string2":"false",
"numeric1":3,
"numeric2":-500
"numeric3":123.456
}
--%>
Regards
James Wiltshire