tedana.io.prep_data_for_json

prep_data_for_json(d) dict[source]

Attempt to create a JSON serializable dictionary from a data dictionary.

Parameters:

d (dict) – A dictionary that will be converted into something JSON serializable

Returns:

An attempt at JSON serializable data

Raises:
  • ValueError if it cannot force the dictionary to be serializable

  • TypeError if you do not supply a dict

Notes

Use this to make something serializable when writing JSON to disk. To speed things up since there are a small number of conversions, this function does not check for serializability, but does use conversion rules for cases encountered where things were not serializable. Add more conversion rules to this function in cases where a tedana-generated object does not serialize to JSON.