Solved

Can I import JSON file into MySQL?

Posted on 2011-03-08
8
4,607 Views
Last Modified: 2012-05-11
Hi,
I have a file in the JSON format which I need to import to mysql. Is there a way I can directly import the file to mysql using Java or do I need to convert it to xml first?

Thanks.
0
Comment
Question by:orazen12
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 35068436
Your best best is to convert it to java objects and then do an update
0
 
LVL 20

Assisted Solution

by:a_b
a_b earned 150 total points
ID: 35068441
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 35068526
It might be a good idea to post an example of something you want to import
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:orazen12
ID: 35068717
CEHJ,
The data is as below:

{    "glossary": {     "title": "example glossary",            "GlossDiv": {            "title": "S",                  "GlossList": {                "GlossEntry": {                    "ID": "SGML",                              "SortAs": "SGML",                              "GlossTerm": "Standard Generalized Markup Language",                              "Acronym": "SGML",                              "Abbrev": "ISO 8879:1986",                              "GlossDef": {                        "para": "A meta-markup language, used to create markup languages such as DocBook.",                                    "GlossSeeAlso": ["GML", "XML"]                    },                              "GlossSee": "markup"                }            }        }    }}
0
 
LVL 3

Expert Comment

by:ss_p
ID: 35069710
crate java objects
0
 
LVL 3

Expert Comment

by:ss_p
ID: 35069714
create java objects
0
 
LVL 92

Accepted Solution

by:
objects earned 350 total points
ID: 35074556
this will handle reading the json
http://code.google.com/p/google-gson/

you can then use jdbc to update the database
0
 

Author Closing Comment

by:orazen12
ID: 35128580
Thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Creating and Managing Databases with phpMyAdmin in cPanel.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

861 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