json-server icon indicating copy to clipboard operation
json-server copied to clipboard

How to get dictionary response instead of list in pagination?

Open prijendev opened this issue 3 years ago • 0 comments

I have db.json and routes.json files. In db.json file I have data in the following manner,

    {    
        "data": [
            {
                "event_name": "molestias, architecto dolor",
                "id": "repellendus esse modi veniam veniam adipisicing",
            }
        ],
        "page": 0
    },
    {
        "data": [
            {
                "event_name": "molestiassds, fg565 dolor",
                "id": "repellendus esse modi sdsd veniam veniam adipisicing",
            },
        ],
        "page": 1
    }    

When I hit URL http://localhost:3000/global_exclusions?page=1, it returns me list of data. [ { "data": [ { "event_name": "molestiassds, fg565 dolor", "id": "repellendus esse modi sdsd veniam veniam adipisicing", }, ], "page": 1 } ]

But, I want just, { "data": [ { "event_name": "molestiassds, fg565 dolor", "id": "repellendus esse modi sdsd veniam veniam adipisicing", }, ], "page": 1 }

Is there any specific change I have to do?

prijendev avatar Dec 22 '21 12:12 prijendev