import json


def ParseJsonStats(logline):
  """Parse json stats logged before compiler_proxy quitting.

  Args:
    logline: string (in json form)

  Returns:
    json object
  """
  try:
    return json.loads(logline)
  except ValueError as ex:
    print('failed to parse stats as json. stats=%s error=%s' % (logline, ex))
    return None