1
{"vsUserName":"d475","vsPassword":"8080","vsIPAddress":"192.168.1.1"}

This is the key value pairs that I have to parse in Android and used to login and password. I am new in android so no knowledge of parsing in android.

4
  • 1
    You shouldn't be posting usernames and passwords. Commented Jun 29, 2015 at 20:02
  • possible duplicate of how to parse JSONArray in android Commented Jun 29, 2015 at 20:02
  • possible duplicate of How to parse a JSON object for a string Commented Jun 29, 2015 at 20:39
  • Its Fake User name and Password ....... Commented Jun 30, 2015 at 5:09

3 Answers 3

1

If you would like to parse JSON into model, then you can use google gson library its easy to use.

{"vsUserName":"d475","vsPassword":"8080","vsIPAddress":"192.168.1.1"}

Other approach is to parse json manually as:

Get the json object first

    JSONObject jObject = new JSONObject(result);

then get key-value pairs

String aJsonString = jObject.getString("STRINGNAME");

and so on...

For further assistance you can visit this link

How to parse JSON in Android

Sign up to request clarification or add additional context in comments.

1 Comment

what is result here ??
0

you should take a look at this - http://www.javatpoint.com/android-json-parsing-tutorial

your json like - {"vsUserName":"d475","vsPassword":"8080","vsIPAddress":"192.168.1.1"}

with help of - http://hayageek.com/android-http-post-get/

try this may be this could be helpful.. i'm not tested it -- pls let me know if problem persist - The steps to do it below -

Follow the steps to send HTTP POST requests. 1. Create an object of HttpClient

  1. Create an object of HttpPost

  2. Add POST parameters with url

  3. Finally making an HTTP POST request

Comments

0
    Boolean bIsSuccess = false; // Write according to your logic this is demo.

    public void parseResponse(JSONObject response) {

        try {
            JSONObject jObject = new JSONObject(String.valueOf(response));
            bIsSuccess = jObject.getBoolean("success");


        } catch (JSONException e) {
            e.printStackTrace();
            Toast.makeText(Class.this, "" + e.toString(), Toast.LENGTH_LONG).show(); // Test
        }

    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.