I have a huge javascript object returned to a GET api call and i want to offer option to limit the number of keys returned like this:
GET /api/
{
"bla1" : {
....
},
"bla2" : {
....
},
"bla3" : {
....
},
"bla4" : {
....
},
"bla5" : {
....
},
"bla6" : {
....
},
"bla7" : {
....
}
}
when limit=2
is added to query params, this should be returned:
GET /api?limit=2
{
"bla1" : {
....
},
"bla2" : {
....
}
}
my main concern is response time. what if i have 100000 objects, i really don't want to loop over them. what shall i do?
EDIT: okey it doesn't have to be last. someone said it is arbitrary. so i guess it could be removed from any place.