my sqlmap.xml
<select id="getList" resultType="hashmap">
SELECT A,B,C,D FROM MYTABLE
</select>
result example
A B C D
john 123 math 100
jade 456 math 78
janet 789 math 98
controller code
@RequestMapping("/my/result.json")
public @ResponseBody List MyResult(){
return myDAO.getList();
}
but, json result is looking confused column sort such as,
[
{"B":123,"C":"math","A":"john","D":100},
{"B":456,"C":"math","A":"jade","D":78},
{"B":789,"C":"math","A":"janet","D":98}
]
I want get result with sql with defined Column names and index.
but in result, it’s different column name index between sql and hashmap.
Any idea how to get json result same as sql result?
To solve this issue, in sqlmap, just set the
resultTypetojava.util.LinkedHashMap: