Support query list serialization.

This change also fixes sorting on serialized query list values.