## to_json()


Serialize a Python object to a JSON string.


Usage


``` python
to_json(obj)
```


Converts the given object into a human-readable JSON string. Supports dicts, lists, strings, numbers, booleans, and None.


## Parameters


`obj: object`  
The Python object to serialize. Must be JSON-serializable.


## Returns


`str`  
A JSON-formatted string.


## Raises


`TypeError`  
If the object is not JSON-serializable.


## See Also

[serialize()](serialize.md#gdtest_docstring_seealso.serialize)  
Serialize to bytes using pickle (supports more types).

[](%60~from_json%60)  
Parse a JSON string back into a Python object.


## Examples

``` python
>>> to_json({"name": "test", "value": 42})
```

'{"name": "test", "value": 42}'
