title: How to provide JSON input directly as a String argument
body: <p>The following code prints the following as input, but I would like to pass this JSON string as input directly to parse method (preferably as string argument). How should I do that?</p>
  
  <p>{"val1":"v1","val2":"v2"}</p>
  
  <pre><code>import com.google.gson.*;
  
  public class ParseJSON {
  
      String val1;
      String val2;
      transient String val3;
  
      public static void main(String[] args) {
          Gson gson = new GsonBuilder().create();
          ParseJSON parseJson = new ParseJSON();
          parseJson.val1 = "v1";
          parseJson.val2 = "v2";
          parseJson.val3 = "v3";
          String requestBody = gson.toJson(parseJson);
          System.out.println(requestBody);
  
          JsonParser parser = new JsonParser();
          // JsonArray array = parser.parse(requestBody).getAsJsonArray();
      }
  }
  </code></pre>