• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

flask-restful / flask-restful / 1160
94%
master: 94%

Build:
Build:
LAST BUILD BRANCH: ma-contribution
DEFAULT BRANCH: master
Ran 17 Mar 2020 01:47PM UTC
Jobs 8
Files 10
Run time 4min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
1160

Pull #874

travis-ci

web-flow
Use flask.json as default encoder

Fix for #873.

Use `flask.json` instead of `json` standard library as the default JSON encoder.

Overriding behavior remains, but this adds the ability for `flask_restful` to pick up the encoder defined for the app, or the api blueprint.

```python
from flask_restful import Api
from flask import Blueprint
from flask import json

class CustomJSONEncoder(json.JSONEncoder):
    def default(self, obj):
        return 'custom_flask_encoder'

blueprint = Blueprint('test', __name__)
blueprint.json_encoder = CustomJSONEncoder
api = flask_restful.Api(blueprint)
app = Flask(__name__)
app.register_blueprint(blueprint, url_prefix='/blueprint')
```

or

```python
app = Flask(__name__)
app.json_encoder = CustomJSONEncoder
api = flask_restful.Api(app)
```
Pull Request #874: Use flask.json as default encoder

280 of 318 branches covered (88.05%)

1 of 1 new or added line in 1 file covered. (100.0%)

804 of 856 relevant lines covered (93.93%)

7.48 hits per line

Jobs
ID Job ID Ran Files Coverage
3 1160.3 (FLASK=1.0.2) 17 Mar 2020 01:47PM UTC 0
93.69
Travis Job 1160.3
6 1160.6 (FLASK=1.0.2) 17 Mar 2020 01:48PM UTC 0
93.46
Travis Job 1160.6
9 1160.9 (FLASK=1.0.2) 17 Mar 2020 01:48PM UTC 0
93.46
Travis Job 1160.9
12 1160.12 (FLASK=1.0.2) 17 Mar 2020 01:49PM UTC 0
93.46
Travis Job 1160.12
15 1160.15 (FLASK=1.0.2) 17 Mar 2020 01:49PM UTC 0
93.46
Travis Job 1160.15
18 1160.18 (FLASK=1.0.2) 17 Mar 2020 01:50PM UTC 0
93.48
Travis Job 1160.18
21 1160.21 (FLASK=1.0.2) 17 Mar 2020 01:51PM UTC 0
93.69
Travis Job 1160.21
24 1160.24 (FLASK=1.0.2) 17 Mar 2020 01:52PM UTC 0
93.46
Travis Job 1160.24
Source Files on build 1160
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #1160
  • Pull Request #874
  • PR Base - master (#1158)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc