com.hurence.logisland.util.string.JsonUtil Maven / Gradle / Ivy
/**
* Copyright (C) 2016 Hurence ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hurence.logisland.util.string;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hurence.logisland.util.time.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Some JSON helper utilities.
*
* @author Thomas Risberg
*
*/
public class JsonUtil {
private static final Logger logger = LoggerFactory.getLogger(DateUtil.class);
private final static ObjectMapper mapper = new ObjectMapper();
public static Map convertJsonToMap(String json) {
Map retMap = new HashMap<>();
if (json != null) {
try {
retMap = mapper.readValue(json, new TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy