Spring Version: 3.9.15.RELEASE OpenJDK8
I want to convert Java Object that is derived from Oracle DB into JSON array.
I need to put JSON array's data into a data table which allows only JSON array type as an input.
I have been trying to use jackson-databind but I'm still struggling.
I won't need any parameter to call the data because the page I'm working doesn't take any further input to refresh or update the data table.
[ {
"ID" : "sample1",
"nickname" : "올드희",
"name": "김영희",
"phone": "010-1234-5678",
"email": "sample1@gmail.com"
},
{
"ID" : "sample2",
"nickname" : "짱구친구",
"name": "김철수",
"phone": "010-5555-1111",
"email": "sample2@gmail.com"
} ]
Above is the desirable Jsonarray form I want to get.
Below is the select query of mapper file.
<select id="selectNormalList" parameterType="string" resultType="Member">
SELECT
M.ID
, NICKNAME
, NAME
, PHONE
FROM
MEMBER M
LEFT JOIN
M_NORMAL N ON(M.ID = N.ID)
WHERE
GRADE = 'N'
</select>
If I have to use jackson-databind because there is no alternative,
Q1) Is Ajax necessary to call the data?
Q2) Is @PathVariable necessary?
If not, I'll be very appreciate with your advice.
You can use spring REST api to write data in json format and save it into java object and insert into database or also you can select data from databases and take it into java object and display data as json format.
To write data in json and save into database you can use postman api and also you need to change in your controller @notations at method :
references :