The OREF you pasted in is a %Status object, so you can manipulate it with %SYSTEM.Status methods (see the documentation). To get the information between the /* ... */ you can use ##class(%SYSTEM.Status).GetErrorText(fileComp).

Hi Menno,

Currently your solution creates an "extra" node because of the code Do jsonObj1.%Set("", obj2). %Set will always create a new node with parameter 1 as the key and parameter 2 as the value.

It seems like what you really want to do is append all of the objects in obj2.OptOuts with obj1.OptOuts. You can do this by iterating through Obj2.OptOuts and using %Push to append each to Obj1.OptOuts. I've modified the code you provided to accomplish this:

Class Test.TestClass
{
  ClassMethod xxx() As %Status
  {
    Set tSc = $$$OK

    Set jsonObj1 = {}.%FromJSON("C:\temp\1.json")
    Set jsonObj2 = {}.%FromJSON("C:\temp\2.json")

    Do jsonObj1.%Remove("NextCursor")
    Do jsonObj2.%Remove("NextCursor")

    Set obj1 = jsonObj1.%Get("OptOuts")
    Set obj2 = jsonObj2.%Get("OptOuts")

    Set OptOuts2Iter = obj2.%GetIterator()
    While OptOuts2Iter.%GetNext(.key , .value ) {
      Do obj1.%Push(value)
    }

    Set objString = jsonObj1.%ToJSON()
    Set formatter = ##class(%JSON.Formatter).%New()
    Do formatter.FormatToStream(jsonObj1, .Streamobj)

    Set ResponseStream = ##class(%Stream.FileBinary).%New()
    Set ResponseStream.Filename = "C:\temp\3.json"
    Do ResponseStream.CopyFrom(.Streamobj)
    Set tSc = ResponseStream.%Save()
    Do ResponseStream.%Close()
    Return tSc
  }
}

Does your user have the %Developer resource?

To use the Atelier APIs your IRIS user needs %Developer. You can add this to your user via the system management portal at System > Security Management > Users.