title: Reading API and GSON Class
body: <p>I am new to JSON data format and java programming language; hence, I cannot find a valid answer. Actually, I have to read this API <a href="https://www.doviz.com/api/v1/currencies/all/latest" rel="nofollow noreferrer">https://www.doviz.com/api/v1/currencies/all/latest</a>, and obtain some important contents from this API. Hence, I decided to use google's GSON class, and I wrote this code. </p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileInputStream;
  import java.io.InputStreamReader;
  import java.net.URL;
  import java.util.Scanner;
  import com.google.gson.Gson;
  
  
  public class Main {
  
      public static void main( String[] args ) throws Exception{
  
          String line = "";
          String jsonString = "";
          URL myUrl = new   URL("https://www.doviz.com/api/v1/currencies/all/latest");
          BufferedReader reader = new BufferedReader( new InputStreamReader(myUrl.openStream()) );
  
          while( (line = reader.readLine()) != null ){
              System.out.println(line);
              jsonString += line;
          }
          reader.close();
  
          jsonString = jsonString.substring(1, jsonString.length() - 1);
  
          Gson gson = new Gson();
          Currency json = gson.fromJson(jsonString, Currency.class);
     }
  }
  
  
  public class Currency {
  
      public double getSelling(){
          return selling;
      }
  
      public double getBuyiing(){
          return buying;
      }
  
      public String getCode(){
          return code;
      }
  
      private double selling;
      private transient long update_date;
      private transient int currency;
      private double buying;
      private transient double change_rate;
      private transient String name;
      private transient String full_name;
      private String code;
  }
  </code></pre>
  
  <p>This code causes error, and as far as I guess, the main reason for the errors is that I do not put backslash in son string like this: "{\"brand\":\"Jeep\", \"doors\": 3}"</p>
  
  <p><code>What I am wondering is why we need to put these backslash ?</code></p>