classmethod DataFrame.from_json(json_str, name, roles=None, ignore=False, dry=False)[source]

Create a new DataFrame from a JSON string.

It will construct a data frame object in the engine, fill it with the data read from the JSON string, and return a corresponding DataFrame handle.

json_str (str): The JSON string containing the data.

The json_str should be in the following format:

json_str = "{'col1': [1.0, 2.0, 1.0], 'col2': ['A', 'B', 'C']}"

name (str): Name of the data frame to be created.

roles(dict[str, List[str]], optional): A dictionary mapping

the roles to the column names. If this is not passed, then the roles will be sniffed from the string. The roles dictionary should be in the following format:

roles = {"role1": ["colname1", "colname2"], "role2": ["colname3"]}
ignore (bool, optional): Only relevant when roles is not None.

Determines what you want to do with any colnames not mentioned in roles. Do you want to ignore them (True) or read them in as unused columns (False)?

dry (bool, optional): If set to True, then the data

will not actually be read. Instead, the method will only return the roles it would have used. This can be used to hard-code roles when setting up a pipeline.


TypeError: If any of the input arguments is of a wrong type. ValueError:

If one of the provided keys in roles does not match a definition in roles.



Handler of the underlying data.


The created data frame object is only held in memory by the getML engine. If you want to use it in later sessions or after switching the project, you have to called save() method.

In addition to reading data from a JSON string, you can also write an existing DataFrame back into one using to_json() or replace/append to the current instance using the read_json() method.