Wednesday 18 September 2013

Java Object to JSON String Convertor

try
   {
    String jsonFilePath= "C:\\Users\\User-1\\Desktop\\ReqJSON\\student.json";
    File jsonFile = new File(jsonFilePath);
    mapper.writeValue(jsonFile, student);
   }
   catch (JsonGenerationException ex) {

    ex.printStackTrace();

   } catch (JsonMappingException ex) {

    ex.printStackTrace();

   } catch (IOException ex) {

    ex.printStackTrace();
   }

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...