• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to store nested JSON data in MYSQL database

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have more than 25,000 headwords for d3...that is almost 25,000 set of json..i want to save datas into mysql database and retrieve in json format which i will use in d3..
i dont know how should i store the nested json data into mysql to access it...it will be better if datas in a single table...but no idea,how to use the table for nested json values..
i just used here a sample nested json...how should i store the data in mysql to access it

sample nested JSON
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ideally your first step should be to parse the json and store in a java class , then think about storing it in db.
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i thing  , i can use.
http://tools.knowledgewalls.com/mysqltabletojavaclass.
and
http://tools.knowledgewalls.com/onlinejsontojavaobjectconverter
am i rite?
 
Swastik Dey
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably yes.   There are lot of  ways to parse json
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i used this tool

and the generated java class is

 
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay... but your question is ambiguous. Do you have a database design already set up to contain that data, and you're bogged down in figuring out how to output the data to that database? Or are you confused about how to design a database to contain that data?
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually,i have one table where some of the rows are null..

PARENT        CHILD1          CHILD2             CHILD3
paren     c1        c11
paren     c1         c12
paren     c1         c12                 c121
paren     c2         c21
paren     c2         c22
paren     c2         c23

when i use jsp to retrieve the data from the table and display in the json format ..IT gives me the output


@Swastik  suggest me to do this with SERVLET..i am new to servlet,so felt difficult to use servlet..thats why i tried to modify the table ,to see whether i get my required json format or not
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it really need to be broken down? Will you be joining on the columns? Or do you just need to store and retrieve the text? Why not just store it as a text blob?
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my required json is ,what i posted in the question..i want to get it without broken..i mean
one common parent
children
sub children

i tried to use JSON OBJECT now

to get output in json format..
i get valid json


but totally wrong when compare with my requirement..
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want nested json format from mysql database which i will use in d3 further
 
surya preethaaa
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any suggestion for the problem i stated or a way to iterate thro mysql to avoid null in json and to have
common parent
               children
                         subchildren
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic