Anshuman Pattnaik Anshuman Pattnaik - 1 year ago 124
Android Question

How to post JSON Array in retrofit using android?

I am working on retrofit but i have no idea how to post JSONArray in retrofit, i am posting the sample JSON please kindly go through it.

"tab": [{
"menu_item_id": "",
"cost": 0,
"quantity": 0,
"name": ""

I am able to create JSONObject model but i am facing some issue in JSONArray model please kindly go through my sample JSON and suggest me some solution.

Answer Source

How did you declare the post method in your api interface? It should be something like this:

void postItemsMethod(@Field("tabs[]") ArrayList<YourItemClass> tabs , Callback<CallBackClass> callback);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download