Package net.sf.json.groovy

Examples of net.sf.json.groovy.JsonSlurper


    private static final String WHILE_1 = "while(1);";

    public static boolean isValidJson(String value) {
        try {
            JSON json = new JsonSlurper().parseText(value);
            return json != null && !(json instanceof JSONNull);
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here


    public static boolean seemsToBeJson(String content) {
        if (!StringUtils.hasContent(content)) {
            return false;
        }
        try {
            new JsonSlurper().parseText(content);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

    public JsonPathFacade(String targetJson) {
        if (!isValidJson(targetJson)) {
            throw new IllegalArgumentException("Invalid JSON: " + targetJson);
        }
        this.currentJson = targetJson;
        jsonObject = new JsonSlurper().parseText(targetJson);
    }
View Full Code Here

TOP

Related Classes of net.sf.json.groovy.JsonSlurper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.