You need to make sure "found" is being updated when the recursive call exits. This can either be done by reference (passing in .found) or simply as a return value (set found instead of do). It is always going through the full loop and never exiting early because once the value is found, it is never passed back up as being found. This means that the loop just continues on. Here are two examples of these solutions

if $isObject(value) {
             do ..JSONIterator(value,newPath,.SearchKey,.SearchVal,.found)

if $isObject(value) {
             set found= ..JSONIterator(value,newPath,.SearchKey,.SearchVal,found)

Based on the documentation, it seems like this may be expected since $GET is expecting a variable, not a value returned from a method call. The main purpose is to protect against undefined references which a method call should never return since an empty string is different than undefined. Since the documentation mentions it accepts multidimensional object properties, it seems like it is assuming this is what the passed in reference is.

Documentation on expected values here.

Hi Michel,

I am not exactly sure which type of stream you are using, but different types appear to override the Read methods.

For example:
%Stream.FileCharacter does not implement a Read method, but it extends %Stream.FileBinary. In %Stream.FileBinary, the Read method is defined as:

Method Read(ByRef len As %Integer = 32000, ByRef sc As %Status) As %RawString

Hi David,

I see you used the "VSCode" tag. The couple of times I have done this in VSCode, I typically just import the XML classes into my system and then once they are loaded, I use the VSCode ObjectScript Explorer and export my classes from there into my project. I've only done it once or twice, so I don't know if there is a better way of doing it.

If you are interested, these are some methods for doing it manually as well that could be scripted to do all your files:

USER>do $system.OBJ.Load("C:\Users\psteiwer\Desktop\Class.xml")
Load started on 03/10/2020 17:40:03
Loading file C:\Users\psteiwer\Desktop\Class.xml as xml
Imported class: PivotSubscriptions.Utils
Load finished successfully.
USER>do $system.OBJ.ExportUDL("PivotSubscriptions.Utils.CLS","C:\Users\psteiwer\Desktop\Class.cls")