Having just done the same thing today, following Marc's comment (which is the same code in the documentation for MIMEParts) should get you what you need.

As it stands, I'm pretty sure you are just passing a handle to a stream to the FormData, rather than referencing the content of the stream.  This section of the example will correctly populate the HTTP Request body:

  // Write out Root MIME Element (containing sub-MIME parts) to HTTP Request Body.
    Set writer = ##class(%Net.MIMEWriter).%New()
    Set sc = writer.OutputToStream(tHttpRequest.EntityBody)
    if $$$ISERR(sc) {do $SYSTEM.Status.DisplayError(sc) Quit}
    Set sc = writer.WriteMIMEBody(rootMIME)
    if $$$ISERR(sc) {do $SYSTEM.Status.DisplayError(sc) Quit}

In your example call, the top level is a JSON object, not an array so iterating over it won't work.  You would need to access it from the children property

However, he ZEN JSON functionality is deprecated in recent versions of IRIS, and the native JSON support is a bit friendlier to use.  The documentation is here: https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

If you use

set obj =  {}.%FromJSON(%request.HttpResponse.Data) 

you should get access to the json object, and then you can use %GetIterator to cycle over the array 

If only seeing new data suits your use case, then you are probably ok with this approach.   You may wish to look at %ValidateIndices() which I believe is present in Cache2018.   This will allow an online check of the index state and can either report on mismatches, or be set to autorepair.  It is MUCH slower than a %BuildIndices, but does not require a full freeze for safety

https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...

Hi Julius

Thanks for your comments, and you are correct in assessing this is for a specific use case (I'm migrating data between 2 structures and want to make sure the exported JSON is EXACTLY the same).

For the first point, I really only care that all values in the source are also in the target.   If I wanted to be thorough, I woudl run the compare in both directions, but since I'm expecting that the target will contain additional properties, I only need a 1 way compare)

For the second point, I actually define the ordering of exporting of arrays explicitly, so I would expect a like for like compare.   For other cases, additional logic would need to be added, as you pointed out

For the last point,  this should return a mismatch, which is good enough for my use case, but again, might not be ideal for other use cases