code: def flatten_json_array(json_string, array_name):
      
  
      result = re.sub('"{}": \\[\r?\n\\s*'.format(array_name), '"{}": ['.format(array_name), json_string, flags=re.MULTILINE)
      flatten_regexp = re.compile('"{}": \\[(.*)(?<=,)\r?\n\\s*'.format(array_name), flags=re.MULTILINE)
      while flatten_regexp.search(result):
          result = flatten_regexp.sub('"{}": [\\1 '.format(array_name), result)
      result = re.sub('"{}": \\[(.*)\r?\n\\s*\\]'.format(array_name), '"{}": [\\1]'.format(array_name), result, flags=re.MULTILINE)
      return result
docs: Flattens all arrays with the same name in the JSON string
  
      :param json_string: JSON string
      :type json_string: str
      :param array_name: Array name to flatten
      :type array_name: str