I was following the link Generate Java class from JSON? to create the POJO classes from json string (and not from schema). I am using jsonschema2pojo jar of version 0.4.10 but could not able to generate the POJO class. My code is as below,
public class App
{
public static void main( String[] args )
{
JCodeModel codeModel = new JCodeModel();
try {
URL source = new URL("file:///C://Users//...//accession.json");
new SchemaMapper().generate(codeModel, "Accession", "com.test", source);
File dir = new File("D://test");
if(dir.exists()){
System.out.println("dir available");
codeModel.build(dir);
}else{
System.out.println("dir not available");
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
So accession.json has json string which need to be converted into POJO. Can anybody please help me here.