pihu
pihu

Reputation: 93

How to convert a bean to JSON using JSON-LIB

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

Upvotes: -2

Views: 2781

Answers (1)

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181430

How about?

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

Upvotes: 2

Related Questions