简体   繁体   中英

what is the database schema for storing nested Json Objects?

I am getting records for a service contains nested json objects as shown below. I am able catch the result. I need to store this result in DB. here I facing problem in storing these result in db.

[
name:"",
geocode: {
latitude: "45.4168953"
longitude: "-75.6927428"
         },
website: {
title: ""
scope: ""
          },
promotion: {
status:true
           },
.....
.....
.....
]

what might be the database schema for storing this nested JSON Oject.

Thanks in advance

Well ,if you are restricted to mysql database , it is simple to new a table named geocode , it has three keys:id ,latitude ,longitude ,then ,in your main table, you have a key named geocode ,whose value is a geocode which points to one row in geocode.It is just a simple one-to-many mapping. So does other composite keys like website , promotion and so on.But according to what I know , NoSQL databases ,such as mongoDB ,has a very good support for JSON object and can absolute meet your requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM