boon/src/main/java/org/boon/expression/BoonExpressionContext.java
private Object doLookup(String objectExpression, Object defaultValue, boolean searchChildren) {

        if (Str.isEmpty(objectExpression)) {
            return defaultValue;
        }

        char firstChar = Str.idx(objectExpression, 0);
        char secondChar = Str.idx(objectExpression, 1);
        char lastChar = Str.idx(objectExpression, -1);

        boolean escape = false;

        switch(firstChar) {
            case '$':
                if (lastChar=='}') {
                    objectExpression = slc(objectExpression, 2, -1);
                } else {
                    objectExpression = slc(objectExpression, 1);
                }
                break;
            case '{':
                if (secondChar=='{' && lastChar=='}') {
                    char thirdChar = Str.idx(objectExpression, 2);

                    if (thirdChar == '{') {
                        escape = true;
                        objectExpression = slc(objectExpression, 3, -3);
                    }else {
                        objectExpression = slc(objectExpression, 2, -2);
                    }
                }
                else {
                    if (lastChar == '}') {
                        return jsonParser.parse(objectExpression);
                    } else {
                        escape = true;
                        objectExpression = slc(objectExpression, 1);
                    }
                }
                break;
            case '[':
                return jsonParser.parse(objectExpression);
            case '.':
                if (secondChar=='.') {

                    String newExp = slc(objectExpression, 2);
                    return parent.doLookup(newExp, newExp, false);
                }
        }

        Object value;
        lastChar = Str.idx(objectExpression, -1);
        if (lastChar==')') {
            value = handleFunction(objectExpression, searchChildren);
        } else {


            value = findProperty(objectExpression, searchChildren);

            value = value == null ? defaultValue : value;

        }

        if (!escape) {
            return value;
        } else {
            return StandardFunctions.escapeXml(value);
        }

    }
private Object doLookup(String objectExpression, Object defaultValue, boolean searchChildren) {

        if (Str.isEmpty(objectExpression)) {
            return defaultValue;
        }

        char firstChar = Str.idx(objectExpression, 0);
        char secondChar = Str.idx(objectExpression, 1);
        char lastChar = Str.idx(objectExpression, -1);

        boolean escape = false;

        switch(firstChar) {
            case '$':
                if (lastChar=='}') {
                    objectExpression = slc(objectExpression, 2, -1);
                } else {
                    objectExpression = slc(objectExpression, 1);
                }
                break;
            case '{':
                if (secondChar=='{' && lastChar=='}') {
                    char thirdChar = Str.idx(objectExpression, 2);

                    if (thirdChar == '{') {
                        escape = true;
                        objectExpression = slc(objectExpression, 3, -3);
                    }else {
                        objectExpression = slc(objectExpression, 2, -2);
                    }
                }
                else {
                    if (lastChar == '}') {
                        return jsonParser.parse(objectExpression);
                    } else {
                        escape = true;
                        objectExpression = slc(objectExpression, 1);
                    }
                }
                break;
            case '[':
                return jsonParser.parse(objectExpression);
            case '.':
                if (secondChar=='.') {

                    String newExp = slc(objectExpression, 2);
                    return parent.doLookup(newExp, newExp, false);
                }
        }

        Object value;
        lastChar = Str.idx(objectExpression, -1);
        if (lastChar==')') {
            value = handleFunction(objectExpression, searchChildren);
        } else {


            value = findProperty(objectExpression, searchChildren);

            value = value == null ? defaultValue : value;

        }

        if (!escape) {
            return value;
        } else {
            return StandardFunctions.escapeXml(value);
        }

    }
Lookup an object and supply a default value.
@param objectExpression
@param defaultValue
@return