我想将以下JSON数组存储到MySql数据库中

我的要求是从Android应用程序将以下数据与MySql DB同步。

[
   {
      "DATE":"Oct 15, 2015 7:09:23 AM",
      "LNG":"75.124",
      "LAT":"15.3647066",
      "IMEI":"2",
      "LOC":"Prabhat Colony"
   },
   {
      "DATE":"Oct 15, 2015 7:09:41 AM",
      "LNG":"75.0078",
      "LAT":"15.4589233",
      "IMEI":"2",
      "LOC":"Hosayellapur"
   },
   {
      "DATE":"Oct 15, 2015 7:15:56 AM",
      "LNG":"74.4977",
      "LAT":"15.849695",
      "IMEI":"2",
      "LOC":"Camp"
   },
   {
      "DATE":"Oct 15, 2015 7:50:19 AM",
      "LNG":"77.209",
      "LAT":"28.6139383",
      "IMEI":"2",
      "LOC":"Rajpath Area"
   },
   {
      "DATE":"Oct 15, 2015 7:50:41 AM",
      "LNG":"77.391",
      "LAT":"28.535515",
      "IMEI":"2",
      "LOC":"Sector - 106"
   },
   {
      "DATE":"Oct 15, 2015 8:07:25 AM",
      "LNG":"77.391",
      "LAT":"28.535515",
      "IMEI":"2",
      "LOC":"Sector - 106"
   },
   {
      "DATE":"Oct 15, 2015 8:20:26 AM",
      "LNG":"77.391",
      "LAT":"28.535515",
      "IMEI":"2",
      "LOC":"Sector - 106"
   }
]


谁能指导我有关将JSON值存储到mysql数据库的最佳方法?

最佳答案

您可以创建一个包含属性的对象,然后反序列化json以获取对象的数组。

然后,您可以使用JPA或其他方法将对象存储在数据库中。

关于java - 如何在JAVA中将JSON数组数据存储到mysql数据库中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33299185/

10-09 06:41
查看更多