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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -