class CenterAdapter implements JsonSerializer<Center>, JsonDeserializer<Center> {

    @Override
    public Center deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
        Center center = new Center();
        if (json instanceof JsonArray) {
            JsonArray array = (JsonArray)json;
            if (array.size() != 2) {
                throw new JsonParseException("Center must be of format [x,y]");
            }
            // TODO check validity of bbox
            center.setX(array.get(0).getAsDouble());
            center.setY(array.get(1).getAsDouble());
        } else {
            throw new JsonParseException("Center must be JSON array");
        }
        return center;
    }

}