I would recommend instead of mark such object as deleted, with such flag like this. Just "move" it to another table some kind of Trash, when you can store this object as a serialized string for example. In this case object will really disappear from his table and will not be availble with via SQL or any other accesses. But in this Trash, you can have information about deletion data, who deleted and information to restore it.

Unfortunately, downloading distributions from WRC is not so easy. For example, you can look at my article Containerization Caché, where I gave an example how to download and install Caché automatically.

Before, we need some variables

product=cache
version=2017.2.0.744.0
arch=lnxrhx64

Download distribution

# WRC Authorization
WRC_USERNAME="user@somecompany.com"
WRC_PASSWORD="password"

wget -qO /dev/null --keep-session-cookies --save-cookies /dev/stdout --post-data="UserName=$WRC_USERNAME&Password=$WRC_PASSWORD" 'https://login.intersystems.com/login/SSO.UI.Login.cls?referrer=https%253A//wrc.intersystems.com/wrc/login.csp' \
 | wget -O - --load-cookies /dev/stdin "https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/distrib/$product-$version-$arch.tar.gz" \
 | tar xvfzC - .

before an upgrade, you should define at least one variable as defined in documentation by your link.

ISC_PACKAGE_INSTANCENAME=$product

for install new instance, you should define more variables

ISC_PACKAGE_INSTALLDIR="/usr/cachesys/"
ISC_PACKAGE_UNICODE="Y"

so, finally, the script will be

#!/bin/bash

product=cache
version=2017.2.0.744.0
arch=lnxrhx64

# WRC Authorization
WRC_USERNAME="user@somecompany.com"
WRC_PASSWORD="password"

wget -qO /dev/null --keep-session-cookies --save-cookies /dev/stdout --post-data="UserName=$WRC_USERNAME&Password=$WRC_PASSWORD" 'https://login.intersystems.com/login/SSO.UI.Login.cls?referrer=https%253A//wrc.intersystems.com/wrc/login.csp' \
 | wget -O - --load-cookies /dev/stdin "https://wrc.intersystems.com/wrc/WRC.StreamServer.cls?FILE=/wrc/distrib/$product-$version-$arch.tar.gz" \
 | tar xvfzC - .


ISC_PACKAGE_INSTANCENAME=$product

/tmp/dsitrib/$product-$version-$arch/cinstall_silent

But it is just a simple example and not covers everything. But can be easily extended by your needs.

{value1,value2, value3} - is incorrect in JSON

In JSON we have objects and arrays, every element in an object has name and value, while an array is a just list of values.

So, object in this format.

{
  "name": "value",
  "name2": "value2"
}

And array 

[ "value1", "value2" ]

And anyway not sure what you want to do.

Look at this article in the documentation about working with JSON in Caché.

set arr = ["value1", "value2", "value3"]
set iter = arr.%GetIterator()
write !,"<switch> my value"
while iter.%GetNext(.key, .value) {
  w !,"<case>",value,"</case>"
}
w !,"</switch>"

You can retrieve list of certificates in a way like this

ClassMethod SSLConfigs() As %String
{
  new $namespace
  set $namespace = "%SYS"
  
  set rs=##class(Security.SSLConfigs).ListNamesFunc()
  set result = ""
  while rs.%Next() {
    set result = result_$lb(rs.Name)
  }
  quit result
}

And result will be in $lb

USER>w $lts(##class(User.Test).SSLConfigs())
Amazon,Google,ISC.FeatureTracker.SSL.Config

This error may be thrown by some different reasons while you call %Save for an object.

In my case at this place "%Save+5" I have a call to method %BuildObjectGraph, which is internal in %RegisteredObject class. Described as "Build the list of reachable objects and their dependencies".  This method calls recursively, so, maybe some troubles with dependencies.