All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fivefaces.cloud.workflow.awsonprem.utils.JsonPathUtils Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fivefaces.cloud.workflow.awsonprem.utils;

import com.jayway.jsonpath.DocumentContext;

import java.util.LinkedHashMap;

public class JsonPathUtils {

    public static void forcePut(DocumentContext context, String path, Object value) {
        int pos = path.lastIndexOf('.');
        String parent = path.substring(0, pos);
        String child = path.substring(pos + 1);
        if (context.read(parent) == null) {
            forcePut(context, parent, new LinkedHashMap<>());
        }
        context.put(parent, child, value);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy