Sort array before serialize it