· Sep 7, 2023 1m read

What to do if you get a MAXSTRING error in JSON conversion of dynamic objects

InterSystems FAQ rubric

You can avoid the error by specifying a stream object as the argument of %ToJSON() used when generating a JSON string from a dynamic object.

A code example is below.

USER>set temp=##class(%Stream.TmpCharacter).%New()

USER>set jsonobj={}

USER>set jsonobj.pro1=["a","b","c","d"]

USER>set jsonobj.pro2=["あ","い","う","え"]

USER>do jsonobj.%ToJSON(temp)

USER>write temp.Size
USER>write temp.Read()

See also the documentation for details.

[IRIS] Serializing large dynamic entities to streams

Serializing large dynamic entities to streams

Discussion (1)0
Log in or sign up to continue