public static Optional<NetworkPorts> fromSlime(Inspector array) {
        List<NetworkPorts.Allocation> list = new ArrayList<>(array.entries());
        array.traverse((ArrayTraverser) (int i, Inspector item) -> {
            list.add(new NetworkPorts.Allocation((int)item.field(portNumberKey).asLong(),
                                                 item.field(serviceTypeKey).asString(),
                                                 item.field(configIdKey).asString(),
                                                 item.field(portSuffixKey).asString()));
            }
        );
        if (list.size() > 0) {
            NetworkPorts allocator = new NetworkPorts(list);
            return Optional.of(allocator);
        }
        return Optional.empty();
    }
Serializes network port allocations to/from JSON.

@author arnej
config-provisioning/src/main/java/com/yahoo/config/provision/serialization/NetworkPortsSerializer.java