So I\'m writing an \"POJO to JSON\" converter. I want to be able to pass in a List
object and convert to JSON.
Hopefully this will make sense<
You need to use #getDeclaredFields() to include private fields, #getFields() only lists the public ones.
With private
fields you will also run into access restriction problems, so you probably want to look into the Field#setAccessible() method as well.
Instead of kls.getfields you could need to use kls.getDeclaredFields() . And if Jason object is your concern I had recommend you a Jackson Codhaus library . In which you can get or set JsonString from your POJO... HTH