Trying to use Spring Boot REST to Read JSON String from POST

前端 未结 5 1550
谎友^
谎友^ 2020-12-04 09:46

Am using the latest version of Spring Boot to read in a sample JSON via Restful Web Service...

Here\'s my pom.xml:



        
5条回答
  •  一向
    一向 (楼主)
    2020-12-04 10:00

    To receive arbitrary Json in Spring-Boot, you can simply use Jackson's JsonNode. The appropriate converter is automatically configured.

        @PostMapping(value="/process")
        public void process(@RequestBody com.fasterxml.jackson.databind.JsonNode payload) {
            System.out.println(payload);
        }
    

提交回复
热议问题