current position:Home>Front-end and back-end data transfer -- about json

Front-end and back-end data transfer -- about json

2022-08-06 07:06:59CSDN Q&A

Recently working on a project with front-end and back-end separation, there have been some doubts about front-end value transfer.

img


This is a method based on axios request, data is the following teacher (a piece of vue code), this is not the point.

img


What confuses me is that if the backend uses the requestbody annotation, should the frontend pass to the backend a json object or a json string?
In addition, the springboot project is a json conversion tool that integrates jackson, so is the interface under the restcontroller class returning a json object to the front end?(I have debugged this point, it is the json object object)
This is a small demo I wrote, please help me see why

img


img


Isn't application/json passing json? If it is written as the above data, the console will report an error

img


img

copyright notice
author[CSDN Q&A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/218/202207301541513471.html

Random recommended