how to write ObjectNode code to below json data? -


i want generate response below. how can using objectnode , objectmapper? in java class have write coding below response:

{     "code": 200,     "time": "2016-05-27t11:15:36+10:00",     "data": {         "result": {             "addresses": {                 "addressid": "180056310",                 "addresssummarytype": "primaryaddresssummary",                 "addresstype": "property address number",                 "status": "confirmed",                 "number": "6",                 "numberto": "8",                 "streetname": "regent",                 "streettype": "street",                 "locality": "wollongong",                 "postcode": "2500",                 "state": "nsw",                 "addresstype": "rm",                 "subaddresses": {                     `entercodehere`                 }             },             "servicelocation": {                 "readforservicedate": "2013-09-27",                 "locationid": "loc000136215004",                 "customerserviceareaid": "csa200000010939",                 "exchangeservicearea": "wlgg",                 "facsrealm": "74",                 "latitude": "-34:25:25.7",                 "longitude": "150:53:27.3"             }         }     } } 

create pojo represent response, appropriate field names , types, annotate fields @jsonproperty , use writevalueasstring method of objectmapper class serialize pojo json string.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -