作者 lixiang

JsonUtils.java

  1 +package org.jeecg.modules.airag.app.utils;
  2 +
  3 +import com.fasterxml.jackson.core.JsonProcessingException;
  4 +import com.fasterxml.jackson.databind.ObjectMapper;
  5 +
  6 +import java.util.HashMap;
  7 +import java.util.Map;
  8 +
  9 +public class JsonUtils {
  10 + public static Map<String, String> jsonUtils(String json) {
  11 + ObjectMapper objectMapper = new ObjectMapper();
  12 + Map<String, String> metadata;
  13 + try {
  14 + metadata = objectMapper.readValue(json, Map.class);
  15 + } catch (JsonProcessingException e) {
  16 + throw new RuntimeException(e);
  17 + }
  18 + return metadata;
  19 + }
  20 +}