我无法让 JSON 正常工作。ObjectMapper
无法解决。库已正确导入。
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONException;
import net.sf.json.util.*;
import com.fasterxml.jackson.*;
public class Json {
private static final String jsonFilePath = "C:\\Users\\Juergen\\Desktop\\filesForExamples\\mapExample.json";
public static void objectToJSON(HashMap<String, Mat> map) {
//Map<String, Object> mapObject = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
try {
objectMapper.writeValue(new File(jsonFilePath), map);
} catch (IOException e) {
e.printStackTrace();
}
}
}