Groovy web console

subscribe to the feed Subscribe
to this

store json

Published 4 weeks ago by edisson guerrero with tags Tailorsoft
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonSlurper 

def url_Json = new URL("").getText();
def personMap = new JsonSlurper().parseText(url_Json)
def newPerson = new store(personMap)
List<Product> p=newPerson.products;
List<Order> o=newPerson.orders;
List<Item> i=newPerson.orders.items;
List<String> items=new ArrayList<String>();
Map<String,Integer> total  = new HashMap<String,Integer>();;

for(item in i){ 
for(un in item){

for(item in p){
for(ids in items){

for(item in items){

for(item in{    
println "+--------------+---------+------------+";
println "| Product "+item+"      |  Orders "+"da" +" |      Total |";
println "+--------------+---------+------------+";
public class store{
private List<Product> products;    
private List<Order> orders;
public class Product{
private String id;
private String name;
private double price;

public class Order{
private List<Item> items; 
private String id; 

public int findproductbyid(){
int x=0;
for (int i=0;i< items.size;i++){
println (items[i].productId)
if (items[i].productId){

return x;


public class Item{
private String productId; 
private int quantity;