Convert Java collections into JSON and JSON to collections

This sample show you how to convert Java collections into JSON string. A collections of fruit is built and converted to json object. Then whereas json object is convert to collections object

This is output of program jsonFruitNames = [“Banana”,”Apple”,”Orange”,”Kiwi”] jsonFruits = [{“name”:”Banana”,”location”:”Cuba”,”recommend”:”Should buy”},{“name”:”Apple”,”location”:”USA”,”recommend”:”Should eat”},{“name”:”Orange”,”location”:”Holland”,”recommend”:””},{“name”:”Kiwi”,”location”:”Sweeden”,”recommend”:””}] fruit.getName() = Banana fruit.getLocation() = Cuba fruit.getRecommend() = Should … Read more

Please share it if you found this useful
Hide Buttons