__init__ constructor

init

Initializes a new data source with data from a JSON file using default parsing options.

def __init__(self, json_path):
    ...
Parameter Type Description
json_path str The path to the JSON file to be used as the data source.

Example

from groupdocs.assembly.data import JsonDataSource

json_data_source = JsonDataSource("staff-member.json")

init

Initializes a new data source with data from a JSON file using the specified options for parsing JSON data.

def __init__(self, json_path, options):
    ...
Parameter Type Description
json_path str The path to the JSON file to be used as the data source.
options JsonDataLoadOptions Options for parsing JSON data.

init

Initializes a new data source with data from a JSON stream using default parsing options.

def __init__(self, json_stream):
    ...
Parameter Type Description
json_stream io.RawIOBase The stream of JSON data to be used as the data source.

Example

import io
from groupdocs.assembly.data import JsonDataSource

json_array = """[
    { "name": "Amara Osei", "age": 41 },
    { "name": "Jonas Weber", "age": 37 },
    { "name": "Lena Park", "age": 29 }
]"""

json_data_source = JsonDataSource(io.BytesIO(json_array.encode("utf-8")))

init

Initializes a new data source with data from a JSON stream using the specified options for parsing JSON data.

def __init__(self, json_stream, options):
    ...
Parameter Type Description
json_stream io.RawIOBase The stream of JSON data to be used as the data source.
options JsonDataLoadOptions Options for parsing JSON data.

See Also