Source code for node_import_json

# This file is part of Sympathy for Data.
# Copyright (c) 2018, Combine Control Systems AB
#
# Sympathy for Data is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Sympathy for Data is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sympathy for Data.  If not, see <http://www.gnu.org/licenses/>.
from sylib.importer import base
from sympathy.api import node as synode
from sympathy.api.nodeconfig import Port, Ports, Tag, Tags
from sympathy.api import importers


[docs]class ImportJson(base.ImportSingle, synode.Node): __doc__ = """ Import a Json or XML file to a Json structure. If ``Importer to use`` is set to ``auto`` the program will try to guess if it is an XML or JSON file, based on the file extension and the content of the first line of the file. """ + base.URL_DOC author = 'Samuel Genheden' icon = 'json.svg' tags = Tags(Tag.Input.Import) name = 'Json' nodeid = 'org.sysess.sympathy.data.json.importjson' plugins = (importers.JsonDataImporterBase, ) outputs = Ports([Port.Json('Imported Json', name='port1')])
[docs]class ImportJsons(base.ImportMulti, synode.Node): __doc__ = """ Import multiple Json or XML files to multiple Json objects. """ + base.URL_DOC author = 'Samuel Genheden' icon = 'json.svg' tags = Tags(Tag.Input.Import) name = 'Jsons' nodeid = 'org.sysess.sympathy.data.json.importjsons' plugins = (importers.JsonDataImporterBase, ) outputs = Ports([Port.Jsons('Imported Jsons', name='port1')])