Skip to main content

Command Palette

Search for a command to run...

BrightScript formatJson() and roList

Updated
1 min read

roList and roArray seem similar but there is at least one difference between them which is how they convert to JSON with formatJson().

roList = createObject("roList")
roList.push(11)
roList.push(12)
roList.push(13)

' Doesn't work
print "roList content: "; formatJson( roList )


roArray = []
roArray.push(21)
roArray.push(22)
roArray.push(23)

' Works
print "roArray content: "; formatJson( roArray )


' So how do we convert a roList to JSON?
' Here is how
roArray.clear()

for each roListItem in roList
    roArray.push( roListItem )
end for

print "roList pushed to roArray content: "; formatJson( roArray )