gatsby-source-custom-api
gatsby-source-custom-api copied to clipboard
I want to get only first 3 elements from an array. Is that possible ?
Let's say we're getting an array of 5 items from the API. Can we get only 3 items, not all the 5 items?
{
"data": {
"finance": {
"data": [
{
"id": "590522000022443198",
"City": "Melaka"
},
{
"id": "590522000025688127",
"City": "Limassol"
},
{
"id": "590522000037762639",
"City": "Cyberjaya"
},
{
"id": "590522000037762487",
"City": "Labuan"
},
{
"id": "590522000022432183",
"City": "Ipoh"
}
]
}
},
}
If you are talking about graphql then you can add limit in your query and limit it to n number of elements in the results.