code: def save_json(json_list, out_path, encoding="utf-8", fields=None):
      r"""
      Save json list to json file which contains json object in each line.
  
      :param json_list: list of dict
      :param out_path: output path
      :param encoding: file's encoding, default: utf-8
      :param fields: json object's fields that needed, if None,
          all fields are needed. default: None
      :return:
      """
  
      if not json_list or not isinstance(json_list, list):
          raise ValueError(
              f"Cant save invalid data {json_list}, provide list of dict plz!"
          )
      # mkdir dir automatically
      dir_path, file_path = os.path.split(out_path)
      if dir_path and not os.path.exists(dir_path):
          os.makedirs(dir_path)
  
      fields = fields if fields else json_list[0].keys()
  
      with open(out_path, "w+", encoding=encoding) as json_file:
          for json_obj in json_list:
              out_json = {k: json_obj[k] for k in fields}
              json.dump(out_json, json_file, ensure_ascii=False)
              json_file.write("\n")
  
imports: import os
  import json
  import csv
label_desc: Use image node_id 4 for calling a global function with example usage: save_json(json_list, out_path, encoding, fields) without return types