<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/modeling/hyperparams/params_dict.py#L352-L452) |

Converts a nested (using '.') comma-separated k=v string to a JSON string.

#### View aliases


**Main aliases**

[`tfm.hyperparams.params_dict.nested_csv_str_to_json_str`](https://www.tensorflow.org/api_docs/python/tfm/hyperparams/nested_csv_str_to_json_str)

<br />

    tfm.hyperparams.nested_csv_str_to_json_str(
        csv_str
    )

Converts a comma-separated string of key/value pairs that supports
nesting of keys to a JSON string. Nesting is implemented using
'.' between levels for a given key.

Spacing between commas and = is supported (e.g. there is no difference between
"a=1,b=2", "a = 1, b = 2", or "a=1, b=2") but there should be no spaces before
keys or after values (e.g. " a=1,b=2" and "a=1,b=2 " are not supported).

Note that this will only support values supported by CSV, meaning
values such as nested lists (e.g. "a=\[\[1,2,3\],\[4,5,6\]\]") are not
supported. Strings are supported as well, e.g. "a='hello'".

An example conversion would be:

"a=1, b=2, c.a=2, c.b=3, d.a.a=5"

to

"{ a: 1, b : 2, c: {a : 2, b : 3}, d: {a: {a : 5} } }"

<br />

<br />

<br />

| ## Args ||
|---|---|
| `csv_str` | the comma separated string. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| the converted JSON string. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If csv_str is not in a comma separated string or if the string is formatted incorrectly. |

<br />