Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9014721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:34:39+00:00 2026-06-16T03:34:39+00:00

I have a app which is connected with web service. I send some data

  • 0

I have a app which is connected with web service. I send some data by Json:

            try {


            JSONObject jsonObject = new JSONObject();
            jsonObject.put("token", regId);
            jsonObject.put("appId", GlobalConfig.getAPPLICATION_ID());
            jsonObject.put("phoneId", 1);

            JSONArray jArrayParam = new JSONArray();
            jArrayParam.put(jsonObject);

            List<NameValuePair> nameValuePair = new ArrayList<NameValuePair>();
            nameValuePair.add(new BasicNameValuePair("Token",jArrayParam.toString()));

            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(GlobalConfig.getSendEmail());
              httppost.addHeader("Authorization", "Basic " + Base64.encodeToString(
                        (GlobalConfig.getAuthString()).getBytes(),Base64.NO_WRAP));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePair, HTTP.UTF_8));

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost);

        } catch (Exception e) {
            // TODO: handle exception
        }

How Can I see how looks this json?
I want to server see something like this:

{"Token": [
{

"token": "asdasfasf",

"appId": 8.8,

"phoneId": 142.369,

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:34:40+00:00Added an answer on June 16, 2026 at 3:34 am

    Create json object as:

     JSONObject jsonObject = new JSONObject();
     jsonObject.put("token", regId);
     jsonObject.put("appId", GlobalConfig.getAPPLICATION_ID());
     jsonObject.put("phoneId", 1);
    
     JSONArray jArrayParam = new JSONArray();
     jArrayParam.put(jsonObject);
    
     JSONObject finaljsonobj = new JSONObject();
    
     finaljsonobj.put("Token", jArrayParam);
    

    Now finaljsonobj JSON Object look as:

    {
      "Token": [
        {
          "token": "asdasfasf",
          "appId": 8.8,
          "phoneId": 142.369,
    
        }
      ]
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web-service running on Windows Azure which returns JSON that I consume
we have windows app. which expected to connect different soap web services. Service urls
I have a web service written in PHP to which an iPhone app connects
I have an asp.net web app which holds its data in an sql server
I have a web service written in PHP to which an iPhone app connects
I have a app which will download a file from web. The download action
I have an app which has a map and some POI on it. I'm
I have an app which contain some images in res/drawable/ and shows them in
I have a few applications which use a single Web Service which resides on
I have a simple ASP.NET web app which uses a WCF Client to talk

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.