Data Transform
Multi-key sort API
Stably sorts an array of objects by one or more key paths, each ascending or descending, with type-aware comparison. Answers 'How do I sort records by multiple fields?', 'How do I do a stable multi-key sort?'.
Price$0.01per request
MethodPOST
Route/v1/data-transform/sort-by
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformsortordermulti-keyarraystablewrangle
API URL
Integration docshttps://x402.hexl.dev/v1/data-transform/sort-byExample request
{
"data": [
{
"a": 2,
"b": 1
},
{
"a": 1,
"b": 9
},
{
"a": 1,
"b": 2
}
],
"keys": [
"a",
{
"key": "b",
"desc": true
}
]
}Example response
{
"result": [
{
"a": 1,
"b": 9
},
{
"a": 1,
"b": 2
},
{
"a": 2,
"b": 1
}
]
}Input schema
{
"type": "object",
"required": [
"data",
"keys"
],
"properties": {
"data": {
"type": "array",
"examples": [
[
{
"a": 2,
"b": 1
},
{
"a": 1,
"b": 9
},
{
"a": 1,
"b": 2
}
]
]
},
"keys": {
"type": "array",
"examples": [
[
"a",
{
"key": "b",
"desc": true
}
]
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}