Issue Type: Bug Bug
Affects Versions: 1.4.2
Assignee: Jörg Schaible
Components: Core
Created: 19/Oct/12 4:38 AM
Description:

When we use JsonHierarchicalStreamDriver to serialize to json string, Long, Integer,.. shows as a number without ", but when the return type is BigDecimal or BigInteger, it adds ". Example:

  • Long
    {"valor":1}
  • BigDecimal
    {"valor":"1"}


To solve it, we are extending JsonWriter and override these functions:

@Override
    public void startNode(String name, Class clazz) {
    	this.currentClass = clazz;
    	
    	super.startNode(name, clazz);
    }
    
    @Override
    protected void addValue(String value, Type type) {
    	if(currentClass.isAssignableFrom(BigDecimal.class) 
    			|| currentClass.isAssignableFrom(BigInteger.class))
    		type = Type.NUMBER;
    	
    	super.addValue(value, type);
    }
Project: XStream
Priority: Major Major
Reporter: Marcial Atiénzar Navarro
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to