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.

Arnon
  • 2,237
  • 15
  • 23
Kartik Setia
  • 31
  • 1
  • 8

3 Answers3

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

Community
  • 1
  • 1
Pankaj kumar
  • 1,357
  • 14
  • 13
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

Ankit Kumar
  • 280
  • 2
  • 17
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
        }

    }
Tarit Ray
  • 944
  • 12
  • 24