I am trying to use the ParserUtil to deserialize and serialize Xively data objects such as Datastream and Datapoint.
While the toJson function works perfectly, I can't get toConnectedObject and toConnectedObjects function working.
The following is the code excerpt and corresponding log.
String jsonDP=ParserUtil.toJson(false, dp);
Datapoint dpNew=ParserUtil.toConnectedObject(jsonDP, Datapoint.class);
LOGGER.debug(ParserUtil.toJson(false, dpNew));
Log:
2013-08-28 11:45:31,348 2064 DEBUG [ParserUtil.java: 136] (main:) Parsing models to json
2013-08-28 11:45:31,376 2092 DEBUG [ParserUtil.java: 187] (main:) Parsed json from models: {"datapoints":[{"at":"2012-02-19T00:00:02.283064Z","value":"261"}]}
2013-08-28 11:45:31,376 2092 DEBUG [ParserUtil.java: 221] (main:) Parsing string to object: {"datapoints":[{"at":"2012-02-19T00:00:02.283064Z","value":"261"}]}
2013-08-28 11:45:31,377 2093 DEBUG [ParserUtil.java: 136] (main:) Parsing models to json
2013-08-28 11:45:31,377 2093 DEBUG [ParserUtil.java: 187] (main:) Parsed json from models: {"datapoints":[{"value":null}]}
2013-08-28 11:45:31,377 2093 DEBUG [XivelyHelper.java: 295] (main:) {"datapoints":[{"value":null}]}
The result of toConnectedObject(jsonDP, Datapoint.class), newDP object, has both fields "at" and "value" set to null.
I tried the same procedure with Datastream object all the fields are null as well.
In this case the datapoints are in an array with just one element.