How to retrieve data from two objects in json file?
<p>If I have records for users and also records for orders, it is proper to save them like that:</p>

<pre><code>{
    "users": [
        {"id": "1", "name": "Allan", "age": "40"},
        {"id": "2", "name": "Jack", "age": "50"}
    ],
    "orders": [
        { "id": "1", "item": "item 1", "userId": "1"},
        { "id": "2", "item": "item 3", "userId": "1"},
        { "id": "1", "item": "item 4", "userId": "1"},
        { "id": "1", "item": "item 51", "userId": "1"},
        { "id": "2", "item": "item 4", "userId": "1"}   
    ]
}
</code></pre>

<p>as you can see I'm coming from the SQL world so I'm saving the 'orders' data with foreign key, is that the right way to save this data as json and if so how can I get all the users with there orders?</p>

<p>Thanks!</p>