Display of JSON Fields

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: json字段显示

| username: 等一分钟

Last night, I upgraded the TiDB cluster from 5.2.3 to 6.5.1. Will data synchronized from MySQL to TiDB using DM be converted to Base64 format?

| username: 等一分钟 | Original post link

mysql: {“kind”: “All”}
tidb: “base64:type253:eyJraW5kIjoiQWxsIn0=”

| username: 等一分钟 | Original post link

The JSON data {“kind”: “All”} can be manually inserted into TiDB without any issues, but it doesn’t work when synchronized from MySQL using DM.

| username: 等一分钟 | Original post link

The initial full synchronization from MySQL works, but the incremental updates do not.

| username: Billmay表妹 | Original post link

In TiDB DM, JSON data is converted to base64 format during synchronization. This is because JSON data may contain special characters, such as double quotes and newline characters, which could cause data parsing errors if transmitted and stored directly. Therefore, to ensure data correctness, TiDB DM encodes JSON data in base64 before transmission and storage.

After TiDB version 6.0, TiDB optimized JSON data handling and supported more JSON functions and operations. This may require TiDB DM to perform additional processing when synchronizing JSON data, such as converting JSON data to base64 format. If you notice that JSON data is converted to base64 format during data synchronization with TiDB DM, this is normal behavior and does not require additional handling.

If manually inserted JSON data can be stored in TiDB normally, but JSON data synchronized using TiDB DM cannot be stored correctly, it may be because TiDB DM encoded the JSON data in base64 during synchronization, leading to data format inconsistencies. You can try decoding the JSON data in your application before storing it in TiDB.

| username: 等一分钟 | Original post link

Does it have anything to do with the DM version?

| username: 等一分钟 | Original post link

Is there a function for direct decoding?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.