title: writing data from json to java object using jackson
body: <p>I have been using jackson library to read data from input stream to java object. </p>
  
  <p>the code is as follows: </p>
  
  <p><strong>json is string in which data is in the form of JSON</strong></p>
  
  <pre><code> BufferedReader br = new BufferedReader(newInputStreamReader(request.getInputStream()));
  
   String json = "";
  
   json = br.readLine();
  ObjectMapper mapper = new ObjectMapper():
  Position position = mapper.readValue(json, Position.class);
  </code></pre>
  
  <p>where Position is a plain getter setter class. Now when I write data to a file using </p>
  
  <pre><code>FileWriter writer = new FileWriter("E://out.txt");
  writer.write(position.getMobile());
  writer.close();
  </code></pre>
  
  <p>It will not writing any data on text file, neither the file is creating.</p>
  
  <p>One thing more, if I only write json as it is to file , it is ok. i mean it is writing the json string in the form of JSON to file.</p>