Api Sort Ordering String Numbers Incorrectly

No system information provided as this is a more general question.

When returning an API request and trying to sort by a field which contains integers, the sorting method returns an order of 1, 10, 2…

I am aware this is down to the algorithm used to sort. Is there any workaround to get this to return string integers in their “correct” order?

The sort method on fields should allow for the sorting of integers as you expect, could you provide the query you’ve used and possibly some code to allow us to further investigate and help?

Thanks for the reply. Ive played around with the field type and it seems that by standard the “number” field will sort integers correctly, but the “text” field does not sort integers as expected as it works alphanumerically. Would be nice if this was integrated though. For now Ive just converted the field to a number field and will have to apply some front end logic to fix things!