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

前端 未结 5 1543
谎友^
谎友^ 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:20

    The issue appears with parsing the JSON from request body, tipical for an invalid JSON. If you're using curl on windows, try escaping the json like -d "{"name":"value"}" or even -d "{"""name""":"value"""}"

    On the other hand you can ommit the content-type header in which case whetewer is sent will be converted to your String argument

提交回复
热议问题