Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Getting path of the JSON local response
- String userDirectory = System.getProperty("user.dir");
- File file = new File(userDirectory + "\\src\\main\\resources\\assets\\pizzas.json");
- //Reading the file
- StringBuilder sb = new StringBuilder();
- JsonReader reader = null;
- try {
- reader = new JsonReader(new FileReader(file));
- } catch (
- FileNotFoundException e) {
- e.printStackTrace();
- }
- //Desarializing
- List<Deal> list = gson.fromJson(reader,
- new TypeToken<List<Deal>>(){}.getType());
- return list;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement