package jtrainer.education.api.serverless.postgresql.function; import com.google.gson.*; public class Product { private int id; private Integer product_type_id; private String ean; private String name; public Product(String json) { Gson gson = new Gson(); Product product = gson.fromJson(json, Product.class); this.id = product.getId(); this.name = product.getName(); this.ean=product.getEan(); this.product_type_id=product.getProduct_type(); } public String toString() { Gson gson = new GsonBuilder().setPrettyPrinting().create(); return gson.toJson(this); } //insert setters and getters here }