How to perform a one to many operation in JSON
This tutorial shows how to structure a json file to perform a one to many relationship as it happens in a relational database type. JSON is a NOSQl type of database.
{
“books”: [
{
“title”: “Devil may cry”,
“year”: 2015,
“author_id”: 1
},{
"title": "Beautiiful ones are not yet born",
"year": 2016,
"author_id": 1
},{
"title": "The rich also cry",
"year": 2016,
"author_id": 2
}
],
"authors":[
{
"author_id": 1,
"author_name": "Jack Sparrow"
},{
"author_id": 2,
"author_name": "Stephen Ambrose"
}
]
}