Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- replace JSONResponse by ORJSONResponse
  • Loading branch information
devkral committed Oct 18, 2024
1 parent 5094593 commit ca26662
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions docs/en/docs/responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The available responses from `Esmerald` are:

* `Response`
* `JSON`
* `OrJSON`
* `ORJSON`
* `UJSON`
* `Template`
* `Redirect`
Expand All @@ -27,14 +27,14 @@ The available responses from `Esmerald` are:

## Important requirements

Some responses use extra dependencies, such as [UJSON](#ujson) and [OrJSON](#orjson). To use these
Some responses use extra dependencies, such as [UJSON](#ujson) and [ORJSON](#orjson). To use these
responses, you need to install:

```shell
$ pip install ujson orjson
```

This will allow you to use the [OrJSON](#orjson) and [UJSON](#ujson) as well as the
This will allow you to use the [ORJSON](#orjson) and [UJSON](#ujson) as well as the
[UJSONResponse](#ujsonresponse) and [ORJSONResponse](#orjsonresponse) in your projects.

### Response
Expand All @@ -61,7 +61,7 @@ Check out the [API Reference for Response](./references/responses/response.md) f
### JSON

The classic JSON response for 99% of the responses used nowaday. The `JSON` returns a
`JSONResponse`.
`JSONResponse` (ORJSON).

```python
{!> ../../../docs_src/responses/json.py !}
Expand All @@ -71,25 +71,20 @@ The classic JSON response for 99% of the responses used nowaday. The `JSON` retu

Check out the [API Reference for JSON](./references/responses/json.md) for more details.

#### JSONResponse
### JSONResponse (lilya)

You can always use directly the `JSONResponse` from Lilya without using the Esmerald wrapper.

```python
from lilya.responses import JSONResponse as JSONResponse
```

or alternatively

```python
from esmerald.responses import JSONResponse
```

## API Reference

Check out the [API Reference for JSONResponse](./references/responses/json-response.md) for more details.

### OrJSON
### ORJSON

Super fast JSON serialization/deserialization response.

Expand All @@ -101,7 +96,7 @@ Super fast JSON serialization/deserialization response.
Please read the [important requirements](#important-requirements) before using this response.

!!! Check
More details about the ORJSOM can be [found here](https://github.com/ijl/orjson).
More details about the ORJSON can be [found here](https://github.com/ijl/orjson).

## API Reference

Expand All @@ -115,6 +110,12 @@ You can always use directly the `ORJSONResponse` from Esmerald without using the
from esmerald.responses.encoders import ORJSONResponse
```

or alternatively (we alias JSONResponse to ORJSONResponse because it is faster)

```python
from esmerald.responses import JSONResponse
```

## API Reference

Check out the [API Reference for ORJSONResponse](./references/responses/orjson-response.md) for more details.
Expand Down
2 changes: 1 addition & 1 deletion esmerald/responses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
Error,
FileResponse,
HTMLResponse,
JSONResponse,
LilyaResponse,
PlainText,
Response,
StreamingResponse,
)
from .encoders import ORJSONResponse as JSONResponse
from .template import TemplateResponse

__all__ = [
Expand Down

0 comments on commit ca26662

Please sign in to comment.