import json


def _parseNative(logs, needle):
  """Parse console logs from Chrome and get decoded JSON.

  Args:
    logs: Chrome log object
    needle (str): the string leading the actual JSON.

  Example:
    >>> _parseNative([{'message':'a=b'},{'message':'ac={"a":[1,2]}'}],'c=')
    {u'a': [1, 2]}
  """
  ret = None
  for log in logs:
    message = log['message']
    loc = message.find(needle)
    if loc >= 0:
      ret = json.loads(message[loc+len(needle):])
  return ret