1. can you omit 'null' value in serialization or make it configable by any way
2. Besides,i need the key in json-map to be left un-quoted(quotes of the key are unnecessary for me at all) after serialization.can you add this feature??
the following is the code Snippets from jsonobject apapted by me :).
------------------------------------------------------
private static boolean addQuote = System.getProperty("net.sf.json.toString.addQuote")!=null;
public String toString() {
...
Object o = keys.next();
if (addQuote){
sb.append( JSONUtils.quote( o.toString() ) );
}else{
sb.append( o.toString() );
}
...
}
------------------------------------------------------
i'm using json-lib 2.2.2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#1 You can skip properties by setting a JsonPropertyFilter on a JsonConfig instance
jsonConfig.setJsonPropertyFilter(PropertyFilter jsonPropertyFilter)
#2 can be solved by calling WebUtils.toString(JSON) no need to change JSONObject
Cheers,
Andres
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. can you omit 'null' value in serialization or make it configable by any way
2. Besides,i need the key in json-map to be left un-quoted(quotes of the key are unnecessary for me at all) after serialization.can you add this feature??
the following is the code Snippets from jsonobject apapted by me :).
------------------------------------------------------
private static boolean addQuote = System.getProperty("net.sf.json.toString.addQuote")!=null;
public String toString() {
...
Object o = keys.next();
if (addQuote){
sb.append( JSONUtils.quote( o.toString() ) );
}else{
sb.append( o.toString() );
}
...
}
------------------------------------------------------
i'm using json-lib 2.2.2
Floyd,
#1 You can skip properties by setting a JsonPropertyFilter on a JsonConfig instance
jsonConfig.setJsonPropertyFilter(PropertyFilter jsonPropertyFilter)
#2 can be solved by calling WebUtils.toString(JSON) no need to change JSONObject
Cheers,
Andres