private JsonElement serializeGroups(@NonNull final List<Group> groups) {
        JsonArray groupsArray = new JsonArray();
        for (Group group : groups) {
            JsonObject groupObj = new JsonObject();
            groupObj.addProperty("name", group.getName());
            if (group.getAddressLabel() == null) {
                groupObj.addProperty("address", MeshAddress.formatAddress(group.getAddress(), false));
            } else {
                groupObj.addProperty("address", uuidToHex(group.getAddressLabel()));
            }
            if (group.getParentAddressLabel() == null) {
                groupObj.addProperty("parentAddress", MeshAddress.formatAddress(group.getParentAddress(), false));
            } else {
                groupObj.addProperty("parentAddress", uuidToHex(group.getParentAddressLabel()));
            }
            groupsArray.add(groupObj);
        }
        return groupsArray;
    }
Returns serialized json element containing the groups

@param groups Group list
@return JsonElement
mesh/src/main/java/no/nordicsemi/android/mesh/MeshNetworkDeserializer.java