// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;

public class ReadJSON2 {
    public static void main(String[] args) throws Exception {
        HttpClient client = new HttpClient();
        GetMethod get = new GetMethod("http://localhost:81/somejson.php");
        client.executeMethod(get);
        String json = get.getResponseBodyAsString();
        System.out.println(json);
        JsonParser gson = new JsonParser();
        JsonElement o = gson.parse(json);
        int iv = o.getAsJsonObject().get("iv").getAsInt();
        String sv = o.getAsJsonObject().get("sv").getAsString();
        System.out.println(iv + " " + sv);
    }
}
