I am using org.json
library for JSON parsing. I have experienced that when I have two methods say getName()
and setName()
and if I comment the getter method in my POJO
class, the setter method also does not work .
But if i don't, it works. Why this happens? Can't we just set the value in POJO
and convert to JSON string?
Can't we just set the value in the POJO and convert to a JSON string?
If you comment out the getter method, the JSON library will no longer serialize the property, because it has no way to get the property.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.