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

Android: How can I send a Post request of an array of objects? #101

Closed
KalebPortillo opened this issue Jun 24, 2016 · 4 comments
Closed

Comments

@KalebPortillo
Copy link

KalebPortillo commented Jun 24, 2016

I writing a app in Android Java, can someone give a example of how to post an array of objects, like:

[
    {
       key: value,
       key: value
    },
    {
       key: value,
       key: value
    },
    {
       key: value,
       key: value
    }
]
@yoavst
Copy link
Collaborator

yoavst commented Jun 25, 2016

using a json lib that converts the array of objects to json?

@KalebPortillo
Copy link
Author

KalebPortillo commented Jun 25, 2016

But the post method just accept an ArryList of Pair<> as parameter

@kittinunf
Copy link
Owner

kittinunf commented Jun 28, 2016

Sorry for late reply. Can you use .body() to help you achieve what you want?

val bodyStr = ....
Fuel.post("<>").body(bodyStr).responseString()

https://github.com/kittinunf/Fuel/blob/676f84cf43b25a65c5577f63c4e7cbaff1473147/fuel/src/main/kotlin/com/github/kittinunf/fuel/core/Request.kt#L100

@KalebPortillo
Copy link
Author

Thanks

@yoavst yoavst closed this as completed Jun 29, 2016
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