We have output from pig stored in a text file. They are tuples containing a user path in the form of urls.
Here are 2 sample tuples:
    (http://www.flipkart.com/",http://www.flipkart.com/jewellery",http://www.flipkart.com/jewellery/rings",http://www.flipkart.com/jewellery/rings/Agni"):1
(http://www.flipkart.com/",http://www.flipkart.com/jewellery",http://www.flipkart.com/jewellery/rings",http://www.flipkart.com/jewellery/rings/Nakshatra"):1
We want our output in the form of a nested json:
{"id":0,      
"name":"(http:\/\/www.flipkart.com\/\"",
"data":"",
"children":
{"id":1,
"name":"http:\/\/www.flipkart.com\/jewellery\"",
"data":"",
"children":
    {"id":2,
    "name":"http:\/\/www.flipkart.com\/jewellery\/rings\"",
    "data":"","children":
        [{"id":3,
        "name":"http:\/\/www.flipkart.com\/jewellery\/rings\/Agni\"):1",
        "data":"",
        "children":"[]"
        },
        {"id":4,
        "name":"http:\/\/www.flipkart.com\/jewellery\/rings\/Nakshatra\"):1",
        "data":"",
        "children":"[]"
        }]
    }
}
}
How can we do this in java?
 
     
    