we have output pig stored in text file. tuples containing user path in form of urls.
here 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 form of 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 in java?
there not shortcut - need clean string , make json. guess trying make jstree?
if want in javascript - write regex, run loop add other variables , convert json.stringify method convert json object. or in case of java clean string, make pojo , create json object using gson or other library.
Comments
Post a Comment