import re


def extract_mapping(json):
  """
  Takes a JSON object read in from a mappings file and extracts a responses
  mapping object from it.
  """
  responses = {}
  for choice in json:
    rkeys = filter(lambda x: re.match(r"\d+", x), choice.keys())
    #choices[choice["id"]] = { k: choice[k] for k in rkeys }
    for k in rkeys:
      responses[choice[k]] = [choice["id"], k]

  return responses