d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Is There User Of The Json-lib Librairie ?
Add Reply New Topic New Poll
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Dec 18 2013 05:56am
Hei,


I would like to do a simple thing with this sh*** librarie, simply ignoring transient field.

Here is my code :

Code

JsonConfig config = new JsonConfig();
config.setIgnoreTransientFields(true);
JSONObject o = (JSONObject) JSONSerializer.toJSON(sd);

Did I miss something important ? I put this code in a method that writes into a file my JSON data. It writes them, but one of my field is transient, and it is not ignored ...

Some solutions plx ?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Dec 18 2013 06:52am
how are you associating the JsonConfig with your JSONSerializer? or does it not need to be associated?
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Dec 18 2013 12:17pm
Quote (carteblanche @ Dec 18 2013 02:52pm)
how are you associating the JsonConfig with your JSONSerializer? or does it not need to be associated?


no need to associated
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Dec 18 2013 12:25pm
Quote (Bremen @ Dec 18 2013 01:17pm)
no need to associated


http://json-lib.sourceforge.net/apidocs/jdk15/index.html

if you dont need to pass the JsonConfig to associate the config with your JSONSerializer, please explain the difference between these two methods for me:

public static JSON toJSON(Object object)
public static JSON toJSON(Object object, JsonConfig jsonConfig)
Member
Posts: 16,218
Joined: Sep 27 2009
Gold: 13.00
Dec 18 2013 02:02pm
Quote (carteblanche @ Dec 18 2013 08:25pm)
http://json-lib.sourceforge.net/apidocs/jdk15/index.html

if you dont need to pass the JsonConfig to associate the config with your JSONSerializer, please explain the difference between these two methods for me:

public static JSON toJSON(Object object)
public static JSON toJSON(Object object, JsonConfig jsonConfig)


Ok why the f*** I didn't see this ... -_-' ... I work too much, i am too tired. Hopefully it was just for testing and was not urgent ~~
Thank you btw, i'm currently whiping myself. I felt strange when I saw that I didn't need to give the config to anything ... QQ

This post was edited by Bremen on Dec 18 2013 02:11pm
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll