The length specified for a JSON column that uses a binary format must be large enough to fit the length of the data in its binary format. However, when retrieving the data, the data is converted to its text equivalent. For the binary formats, strings are stored in UTF8, and the data is converted to UNICODE when retrieved.
If the length is not large enough for the text representation of the data, you can store the data in the binary format, but you cannot retrieve the binary data as text format. An error is reported if you try to select the data without casting to a larger size. Therefore, determining an appropriate length for the column requires planning. The following example shows a way to determine this length.