package com.bytesw.bytebot.etl.utils;

import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.PathNotFoundException;
import lombok.extern.log4j.Log4j2;

@Log4j2
public class JsonUtils {
    public static Object getFieldFromJson(String json, String jsonPath) {
        Object result = null;
        try {
            result = JsonPath.parse(json)
                    .read(jsonPath);
        } catch (PathNotFoundException e) {
            log.debug(e);
        } catch (Exception e) {
            log.error(e);
        }
        return  result;
    }
}
