chile chile -4 years ago 43
Java Question

which is better to return in a springMVC interface?

In a springMVC controller,

which is better to return?

A json objcet or a json string?

Answer Source

One of the big features Spring provides you is automatic conversion between formats, such as POJOs and JSON or XML. Don't reinvent the wheel--just return the POJO (or a ResponseEntity<Pojo> if needed). This makes your code much simpler, more reliable, and easier to test.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download