1

どこにでも「\」が表示されるのはなぜですか?

私が使用する方法:

@RequestMapping(value = '/showFromMongo', method = RequestMethod.GET)
    def showFromMongoDB() {
        //println 'testit'
        def obj = repository.findByLastName("Vinodh");

        ObjectMapper myObjectMapper = new ObjectMapper();
        myObjectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
        def temp = []
        obj.collect{
            temp <<  myObjectMapper.writeValueAsString(it)
            }
        temp
    }

私が得る出力:

[  
   "{\"id\":\"54fe7bbfd416859826ae53ea\",\"firstName\":\"Priya\",\"lastName\":\"Vinodh\"}",
   "{\"id\":\"54fe7be8d416f74f961678fa\",\"firstName\":\"Mrithula\",\"lastName\":\"Vinodh\"}"
]

「\」を削除するにはどうすればよいですか。

4

0 に答える 0