我有一个包含json格式的HashMap客户列表的文件.
像这样:
{"Davide":{"name":"Davide","cf":"FRCDVD","pi":"1234","telephone":"333","website":"www","sector":"Student","address":"Rome"}}
这只是列表的一个客户.
每次调用控制器时,我都想从文件中获取数据并将它们转换为HashMap列表.
我尝试这样做:
HashMap<String,Customer> listCustomer = new HashMap<>(); listCustomer = new ObjectMapper().readValue(pathCustomerFile,HashMap.class); //This line gives me error
我收到了这个错误:
org.codehaus.jackson.JsonParseException: Unexpected character (‘/’ (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature ‘ALLOW_COMMENTS’ not enabled for parser)
我怎样才能做到这一点?