How to get Jersey client to write `[` and `]` around root request entity?



This really simple request is giving me a headache...


I'm trying to POST data into InfluxDB using the Jersey client.


They want the data in this format


[ { "name": "log_lines", "columns": ["time", "line"], "points": [ [1400425947368, "here's some useful log info"] ] } ]


So my entity looks like this: @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class InfluxDbStat implements Serializable { private static final long serialVersionUID = 1L; @XmlElement public String name; @XmlElement public String[] columns; @XmlElement public String[] points; }


Which translates to: {

"name":"pointcut_performance", "columns":[

"time", "pointcut", "length" ], "points":[

"1412098229880", "com.xxx.notes.restapi.NoteTakerController.postNote(ApiNote)", "105" ] }


And I'm invoking the endpoint like this:


influxDbResource.queryParam("u", influxDbUser).queryParam("p", influxDbPassword).queryParam("time_precision", "ms").accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post(influxDbStat);


How do I get it to print square brackets as the root?


No comments:

Post a Comment