Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request with "Content-Type: application/json" #45

Closed
mindflayer opened this issue Feb 22, 2013 · 4 comments
Closed

Request with "Content-Type: application/json" #45

mindflayer opened this issue Feb 22, 2013 · 4 comments

Comments

@mindflayer
Copy link
Contributor

What about adding support for requests in JSON format?

I could even contribute to it, if you help and point me to the right way to do it, because I'm approaching Flask for the first time in this period.

Regards,
Giorgio

@ryanhorn
Copy link
Contributor

Hi, the JSON mediatype is already supported. Just add location="json" to your Argument. Ex:

parser = reqparse.RequestParser()
parser.add_argument("name", location="json")

@mindflayer
Copy link
Contributor Author

Excellent! 👍

@eduardonunesp
Copy link

Great !

@ghost
Copy link

ghost commented Aug 8, 2014

@ryanhorn what if the json is an array of objects. So for example:
{
"names" : [
{"name":"abc"},
{"name":"xyz"}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants