java - How to convert ArrayList<String> to JSON object using Jackson in Spring @ResponseBody -
server layer return list of string value, like
{"bob", "charlotte", "johnson", "david"...} now need list string json object push front end, like
[{id: "bob"}, {id: "charlotte"}, {id: "johnson"}, {id: "david"...}] or
[{name: "bob"}, {name: "charlotte"}, {name: "johnson"}, {name: "david"...}] any label fine, need label make json object. jackson has convert list of string default i.e. {string: "bob"}? sweet......
the easiest thing make controller method return structure maps json want - example list<someobject> someobject class string id field.
Comments
Post a Comment