Quantcast
Channel: Azure Mobile Apps forum
Viewing all articles
Browse latest Browse all 3756

Sending Json Array from Android Device to Mobile Azure Services backend javascript not working

$
0
0

How to send Json array to backend javascript in mobile azure services from Android device.

Below is the c# coding from windows store app which is working correctly.

JArray jsonArray = new JArray();
            jsonArray.Add(JToken.FromObject(new Contact() { Name = "Clarke", ContactNo = "123456" }));
            jsonArray.Add(JToken.FromObject(new Contact() { Name = "Jordan", ContactNo = "4513264" }));

JToken x = await App.MobileService.InvokeApiAsync("userservice/UploadContacts", jsonArray);

When i test through Fiddler its working correctly. But when i send from android device i am getting the data in the server as

{ values: [ { nameValuePairs: [Object] }, { nameValuePairs: [Object] } ] }

the number of records are matching but the instead of actual data i receive nameValuePairs: object.

Below is the android coding.

JSONArray book;
JSONObject job = new JSONObject();
Contact c = new Contact();
c.ContactNO = "9067655676";
c.Name =" abcd"

job.add(c);

Contact c1 = new Contact();
c1.ContactNO = "999999999";
c1.Name =" efgh"
job.add(c1);

book = new JSONArray(job);


mClient.invokeApi("userservice/UploadContacts", book, Contact.class , new ApiOperationCallback() 
{
         //onCompleted callback code..............
}

Someone please help me solve this problem........




Viewing all articles
Browse latest Browse all 3756

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>