XStream

add an option to hide system attributes (e.g. the class name) in the json

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.2
  • Fix Version/s: 1.3.1
  • Component/s: IO
  • Labels:
    None

Description

Box has a list of Product
public class Box {

private Integer id;

private String name;

private List<Product> products = new ArrayList<Product>();

// getters and setters
}

I serialize the box instance to json, the result is
{"box":{"id":"1","name":"box1","products":{"product":[
{"id":"1","name":"product1","price":"11.0"},

{"id":"3","name":"product3","price":"33.0"}

]
}}}

but what I want is( without alias of class name: "box" , "product")
{"id":"1","name":"box1", "products": [
{"id":"1","name":"product1","price":"11.0"},

{"id":"3","name":"product3","price":"33.0"}

]
}

The tree of Ext requires the latter form

So if possible, please provide a option to hide the class names, thanks

Activity

Hide
Joerg Schaible added a comment -

Clone of XSTR-434 which has been used for different issue.

Show
Joerg Schaible added a comment - Clone of XSTR-434 which has been used for different issue.
Hide
Joerg Schaible added a comment -

It is possible now to omit system attributes by set null as alias for the system attribute with the new XStream call aliasForSystemAttribute(). Implemented in the head revision.

Show
Joerg Schaible added a comment - It is possible now to omit system attributes by set null as alias for the system attribute with the new XStream call aliasForSystemAttribute(). Implemented in the head revision.
Hide
Joerg Schaible added a comment -

Set correct fix version.

Show
Joerg Schaible added a comment - Set correct fix version.
Hide
Joerg Schaible added a comment -

Fixed for upcoming release.

Show
Joerg Schaible added a comment - Fixed for upcoming release.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: