JsonParseException: Unrecognized token 'http': was expecting ('true', 'false' or 'null')

前端 未结 4 1749
有刺的猬
有刺的猬 2021-01-04 06:10

We have the following string which is a valid JSON written to a file on HDFS.

{  
  \"id\":\"tag:search.twitter.com,2005:564407444843950080\",
  \"objectTyp         


        
4条回答
  •  余生分开走
    2021-01-04 06:28

    It might be obvious, but make sure that you are sending to the parser URL object not a String containing www adress. This will not work:

        ObjectMapper mapper = new ObjectMapper();
        String www = "www.sample.pl";
        Weather weather = mapper.readValue(www, Weather.class);
    

    But this will:

        ObjectMapper mapper = new ObjectMapper();
        URL www = new URL("http://www.oracle.com/");
        Weather weather = mapper.readValue(www, Weather.class);
    

提交回复
热议问题