Additional JSON functionality, such as JSON (de)serialization for arbitrary classes was at one point available but currently under review. It may appear in one of future versions. I've posted a workaround.

You can also check RESTForms - REST API  for your persistent classes, it does support JSON (de)serialization. Another article about RESTForms.

Another example - lets say you want to delete several files and check that all is fine:

ClassMethod MassDelete()
{
  #dim sc As %Status = $$$OK

  // Deletes the file. Returns true if it succeeds and false otherwise.
  // Pass return by reference to obtain the low level return value in case of errors
  #define del(%file,%return) ##class(%File).Delete(%file,%return)

  set file1 = "file1.txt"
  set file2 = "file2.txt"
  if (('$$$del(file1, .return1)) | ('$$$del(file2, .return2))) {
    set sc = $$$ERROR($$$GeneralError, "Files '%1', '%2' deletion failed with codes: %3, %4", file1, file2, $get(return1), $get(return2))
  }
  quit sc
}

In case of "||" if the first delete was successful , the second delete would not be called. Use '|' to attempt both deletes