BidiMap outNames = model.outputStateNames;
model.outputStateNames = null;
// now register the builders for matrix / vector
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Matrix.class, new JsonMatrixAdapter());
builder.registerTypeAdapter(Vector.class, new JsonVectorAdapter());
Gson gson = builder.create();
// create a model
JsonObject json = new JsonObject();
// first, we add the model
json.add(MODEL, new JsonPrimitive(gson.toJson(model)));