code: def write_json(data, filename):
      
  
      def custom_default(obj):
          if obj is None or (hasattr(obj, 'isNull') and obj.isNull()):
              return ''
          raise TypeError
  
      with open(filename, 'w') as json_file:
          json.dump(data, json_file, indent=2, default=custom_default)
docs: Custom handler for writing json file in InaSAFE.
  
      Criteria:
      - use indent = 2
      - Handle NULL from QGIS
  
      :param data: The data that will be written.
      :type data: dict
  
      :param filename: The file name.
      :type filename: str