# Dictionary

The base class of the WebIDL dictionaries. Methods take them as typed dataclasses in place of plain dicts.

### *class* webrtc.models.dictionary.Dictionary

The base class of the dataclasses of WebIDL dictionaries.

Methods take these dataclasses in place of plain dicts. [`from_json()`](#webrtc.models.dictionary.Dictionary.from_json) and [`to_json()`](#webrtc.models.dictionary.Dictionary.to_json) convert them to and
from the JSON form that is exchanged with the remote peer.

#### *classmethod* from_json(value)

Creates the dictionary from its JSON form, like one received from the remote peer.

Keys can be the camelCase names of the specification or the snake_case ones. Unknown keys are ignored, and
nested dictionaries are converted too.

* **Parameters:**
  **value** ([`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)) – The JSON form.
* **Returns:**
  The dictionary.
* **Raises:**
  [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError) – If the value isn’t a mapping, or a required member is missing.
* **Return type:**
  Self

#### to_json()

Returns the JSON form of the dictionary, like one to send to the remote peer.

Keys are the camelCase names of the specification. Members that are [`None`](https://docs.python.org/3/builtins/constants.html#None) are left out, enums become
their values, and nested dictionaries are converted too.

* **Returns:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict) – The JSON form.
* **Return type:**
  [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [object](https://docs.python.org/3/builtins/functions.html#object)]
