@Override
    public JsonElement serialize(final List<MeshModel> models, final Type typeOfSrc, final JsonSerializationContext context) {
        final JsonArray jsonArray = new JsonArray();
        for (MeshModel model : models) {
            final JsonObject meshModelJson = new JsonObject();
            if (model instanceof VendorModel) {
                meshModelJson.addProperty("modelId", String.format(Locale.US, "%08X", model.getModelId()));
            } else {
                meshModelJson.addProperty("modelId", String.format(Locale.US, "%04X", model.getModelId()));
            }

            meshModelJson.add("bind", serializeBoundAppKeys(model.getBoundAppKeyIndexes()));
            meshModelJson.add("subscribe", serializeSubscriptionAddresses(model));

            if (model.getPublicationSettings() != null) {
                meshModelJson.add("publish", serializePublicationSettings(model.getPublicationSettings()));
            }

            jsonArray.add(meshModelJson);
        }
        return jsonArray;
    }
Class for de-serializing a list of elements stored in the Mesh Configuration Database
mesh/src/main/java/no/nordicsemi/android/mesh/transport/MeshModelListDeserializer.java