gpt4 book ai didi

java - 无法在mysql表字段中存储完整的json字段

转载 作者:行者123 更新时间:2023-12-01 16:25:05 28 4
gpt4 key购买 nike

我在 api 响应中收到大量 json 数据。我正在尝试将此 json 响应存储在本地 mysql 表中。但无法存储完整的 json 响应。请查找以下 json 信息。

示例 API json 响应:

{
"responseCode": 200,
"date": "2020-06-03",
"message": "Success",
"couponDetails": {
"total": 14949,
"codes": "35033769,35441136,35803675,34407176,34717909,34950692,35059148,35452352,35688911,35904465,35904658,35904753,35904824,35904942,35905306,35905318,35905434,35905673,35906615,35907029,35907154,35907222,35907345,35907592,35907683,35907951,35908161,35908194,35908206,34664348,34664436,34665057,34665072,34665768,34665950,34666051,34666110,34666879,34667228,34668101,34670133,34670162,34670259,34670661,34670687,34670994,34671179,34671296,34672207,34672276,34672631,34672747,34673619,34673709,34675355,34676588,34677690,34678019,34679260,34679468,34680550,34680694,34680838,34683321,34684752,34684796,34685198,34685826,34686220,34686276,34351922,34352193,34352369,34352553,34353629,34353971,34355064,34355541,34355625,34356802,34357668,34357869,34357922,34360451,34360500,34360764,34361049,34361174,34361315,34362337,34362412,34363370,34364187,34365025,34365188,34365415,34365904,34366777,34366877,34367361,34368025,34368078,35542974,35543013,35543084,35268238,35268397,35268774,35269689,35269933,35270038,35250597,35063719,35064231,35064237,35270577,35270705,35270969,35064514,35064963,35065129,35251645,35251660,35251798,35253022,35253300,35272389,35272446,35272519,35272640,35272641,35273596,35273716,35423127,35423184,35423372,35424244,35425607,35485524,35486647,35486711,35486970,35487111,35470199,35470485,35488099,35488145,35488270,35490204,35534378,35535484,35535520,35535559,35535601,35535818,21979363,21508096,26237385,24734847,22263784,26889428,29292212,20415646,21836743,20300178,21831783,21198543,23739734,29773862,20715551,25488915,28894112,26536357,26695866,27133857,29133336,28763373,21850298,21990790,27757421,2421785723"
}
}

在我的本地数据库表中,我只能插入以下信息,该信息并不完整:

{
"responseCode": 200,
"date": "2020-06-03",
"message": "Success",
"couponDetails": {
"total": 14949,
"codes": "35033769,35441136,35803675,34407176,34717909,34950692,35059148,35452352,35688911,35904465,35904658,35904753,35904824,35904942,35905306,

Mysql表结构:

CREATE TABLE `bookdata_codeinfo_history` (
`generated_date` date DEFAULT NULL,
`book_code` longtext,
`service` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

我想将 json 存储在“book_code”字段中,但只存储很少的信息。我使用的是mysql-5.7.13版本。请告诉我如何解决这个问题

最佳答案

我认为,对表进行建模的更好方法是将 book_code 字符串分解为单独的行,而不是尝试将书籍代码存储为字符串。

这将有助于搜索数据和数据模型的 future 可扩展性。

关于java - 无法在mysql表字段中存储完整的json字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62164616/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com