Feeds and folders are manually sorted via the so-called sort IDs. They are 8-character strings consisting of hex characters. Sort IDs are present in the subscription list and folder/tag list methods. The items that are returned via those methods are not sorted, so you should use the sort IDs to find the desired order.
To do so, you need to first fetch the stream preference list.
subscription-ordering pair for each folder is what you need. Get the value and split on each 8th character. You will get a list with sort IDs in the desired order. You can then iterate over those IDs and place the feeds/folders in the correct order.
For example this string:
Is broken down into the following IDs: