MySQL: Upload a JSON file into a table programmatically

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.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James BilousSoftware EngineerCommented:
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:
Omer-PitouAuthor Commented:
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
James BilousSoftware EngineerCommented:
In that case there are online converters that will get you from json to csv that you can fin pretty readily via Google search.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Omer-PitouAuthor Commented:
Do you know any 3rd party library that I can embed into the app
James BilousSoftware EngineerCommented:
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?
Omer-PitouAuthor Commented:
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.
James BilousSoftware EngineerCommented:
I would use the org.json.CDL library:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.