Implementing a function that returns a JSON array based on a set of vertex IDs.