Turn a JSON object into a list of pairs. Useful for indexing.