title: Print data of JSONObject in java.
body: <p>I have a <code>JSONObject</code> consisting of a simple json document(doesn't consists nested objects or <code>JSONArray</code>). I want to print that data.</p>
  
  <pre><code>import org.json.JSONObject;
  import java.util.Scanner;
  public class Test2{
    public static void main(String[] args) {
      Scanner scan=new Scanner(System.in);
      String s=scan.nextLine();
      JSONObject j=new JSONObject(s);
      // What code should I write here
    }
  }
  </code></pre>
  
  <p>Let us say if the input is <code>{fname:"Stack", lname:"Overflow"}</code> then the output should be:-</p>
  
  <pre><code>fname =&gt; Stack
  lname =&gt; Overflow
  </code></pre>
  
  <p>If the input is <code>{country:"India", city:"Delhi"}</code>then the output should be:-</p>
  
  <pre><code>country =&gt; India
  city =&gt; Delhi
  </code></pre>
  
  <p>Can you please help me how I can do it.</p>