[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now


MySQL: Upload a JSON file into a table programmatically

Posted on 2016-08-08
Medium Priority
Last Modified: 2016-09-26
Does anymore know about a technique, a tool or set of commands to load a JSON file into a mysql table. Please, note fields will match with the JSON structure.
I know I can do it in MySQL Workbench, but I want to automate the process.

Question by:Omer-Pitou
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Assisted Solution

by:James Bilous
James Bilous earned 2000 total points
ID: 41747563
This is a common task called data "marshalling". Essentially, what you'll want to do is write a java program that takes the JSON from in memory, connects to a database using JDBC (or some other database connection API), and loops through your JSON while inserting the data as rows in your database. Here is a good article on the process:


Author Comment

ID: 41747774
Thanks James,
What I am avoiding is to loop through these rows.
I think I will convert it to CSV, and load it with MySQL LOAD INFILE

Expert Comment

by:James Bilous
ID: 41747794
In that case there are online converters that will get you from json to csv that you can fin pretty readily via Google search.
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.


Author Comment

ID: 41747800
Do you know any 3rd party library that I can embed into the app

Expert Comment

by:James Bilous
ID: 41747818
What exactly are you doing? You didn't really give a lot of context to your problem. You're making an android app that receives JSON and you want to put it into a database by converting it to CSV first? This seems to be the most round about and difficult way to do this. Why not just use all the tools and APIs available from the Android Developmen toolkit that were made for this exact purpose?

Author Comment

ID: 41747831
I am not developing an Android app.
It is a SE app which will in a local network.
Some of the data need to be transferred to a remote database (web server) to serve the web dashboard application. This will be done through a web service.

Accepted Solution

James Bilous earned 2000 total points
ID: 41747848
I would use the org.json.CDL library:


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question