title: Connecting Android app to Java server via JSON
body: <p>I am creating an android app which stores data such as "name" "latitude" "longitude" in a MSSQL database.</p>
  
  <p>I am planning to connect the android app to a server which then connects to a mssql database server.</p>
  
  <p>I have established the Java -> MSSQL connection fine and can read/write data with no problems.</p>
  
  <p>Now I want to be able to send / receive these objects between the java server and the android app.</p>
  
  <p>I created 'file.json' and stored it on a web server containing:</p>
  
  <pre><code>{"name":"shopname","address":"123 fake street","type":"unknown", "notes":"service is really good."}
  </code></pre>
  
  <p>and I am able to pull this data back into an object with no trouble.</p>
  
  <p>My question is:</p>
  
  <p>How do I get the java server to serve this data to my android app?  I want to be able to use:</p>
  
  <pre><code>URL objectGet = new URL("http://10.0.1.8/file.json");
      URLConnection yc = objectGet.openConnection();
      BufferedReader in = new BufferedReader(
              new InputStreamReader(
              yc.getInputStream()));
  </code></pre>
  
  <p>and then</p>
  
  <pre><code>DataObject objs = gson.fromJson(in, DataObject.class);
  </code></pre>
  
  <p>What would be the best way of setting this up?</p>