[Java] Realize the conversion of Http Server && object and JSON

Simple Http Server using native Java

Create a simple HTTP-based Web Server application using the HttpServer Class provided by JDK

insert image description here
insert image description here

Use Jackson to complete the conversion of objects and JSON

insert image description here
If you can’t remember which package it is, look it up in the maven repository
insert image description here
, copy this
insert image description hereand then pull the json package
insert image description here

Serialization: object -> json
insert image description hereDeserialization: json->object
insert image description here
If there is no Person() parameterless construction, an error will be reported.
insert image description here

Guess you like

Origin blog.csdn.net/qq_30738155/article/details/128228988