How to convert a bean to JSON using JSON-LIB

2.8k Views Asked by At

Cn anyone show a example of generating a JSOn from a bean class using JSON-LIB? I am not able to find a example to understand this.

Thanks

1

There are 1 best solutions below

2
On

How about?

MyBean mb = new MyBean();
JSON json = JSONObject.fromObject(mb);