简体   繁体   English

将JSON数据存储到MySQL数据库中

[英]Storing JSON data into MySQL database

I am having a JSON file with multiple and multi-level data. 我有一个包含多级和多级数据的JSON文件。 Now I want to store this data into MySQL database. 现在,我要将这些数据存储到MySQL数据库中。 I searched many links but didn't suit to my data and none of it helped me. 我搜索了许多链接,但不适合我的数据,但没有一个对我有帮助。

My JSON data: http://fiddle.jshell.net/4QNYk/ 我的JSON数据: http : //fiddle.jshell.net/4QNYk/

I am new to JSON and Java. 我是JSON和Java的新手。 Please help me out. 请帮帮我。

Depending on what you want to do later with the JSON, storing it as a normal text seems to be the best idea on MySQL at the moment. 根据您稍后要使用JSON进行的操作,将其存储为普通文本似乎是目前MySQL上的最佳方法。 Other DBMS like PostgreSQL are having some datatype for JSON -- but assuming you having you application magic at Java-side and not wanting to start fuzzying around with the JSON on database layer, text is totally fine. 诸如PostgreSQL之类的其他DBMS都具有JSON的某种数据类型-但是,假设您在Java端应用了魔术,并且不想在数据库层开始使用JSON进行模糊处理,那么文本就可以了。

Of course, if you want to search inside the JSON it's maybe not the best way of storing them. 当然,如果要在JSON中搜索,可能不是存储它们的最佳方法。 But as mentioned in the comments, there are other DBMS are better choice. 但是正如评论中提到的那样,还有其他DBMS是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM