When using the JsonConstruct:Write method (JsonArray/JsonObject) with a LONGCHAR variable, you have to use it with INPUT-OUTPUT since the OUTPUT version is defined with CHARACTER and produces errors if the output is longer than 32k chars.
If you don't specify a parameter mode is also works, but you shouldn't do that (#528).
This should be a general rule, not just for these types since one could produce the same with custom methods.
DEFINE VARIABLE loJsonObject AS Progress.Json.ObjectModel.JsonObject NO-UNDO.
DEFINE VARIABLE liCount AS INTEGER NO-UNDO.
DEFINE VARIABLE llcOutoput AS LONGCHAR NO-UNDO.
loJsonObject = NEW Progress.Json.ObjectModel.JsonObject().
DO liCount = 1 TO 1000:
loJsonObject:Add(STRING(liCount), "01234567890123456789012345678901234567890123456789":U).
END.
// Error -> Attempt to exceed maximum size of a CHARACTER variable. (9324)
// loJsonObject:Write(OUTPUT llcOutoput).
// Works
loJsonObject:Write(INPUT-OUTPUT llcOutoput).
// Also works
loJsonObject:Write(llcOutoput).
When using the JsonConstruct:Write method (JsonArray/JsonObject) with a LONGCHAR variable, you have to use it with INPUT-OUTPUT since the OUTPUT version is defined with CHARACTER and produces errors if the output is longer than 32k chars.
If you don't specify a parameter mode is also works, but you shouldn't do that (#528).
This should be a general rule, not just for these types since one could produce the same with custom methods.