package com.ydtech.utils; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.ReadContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class JsonPathUtils { final static Logger logger = LoggerFactory.getLogger(JsonPathUtils.class); public static String read(ReadContext context, String path) { String result = ""; try { result = context.read(path, String.class); } catch (Exception e) { logger.error(e.getMessage()); } return result; } public static void write(DocumentContext context, String path, String value) { DocumentContext result; try { context.set(path, value); } catch (Exception e) { logger.error(e.getMessage()); } //return result; } }