private void parse()

in src/main/java/org/apache/sling/jcr/contentparser/impl/JsonContentParser.java [114:162]


    private void parse(ContentHandler handler, JsonObject object, String path) {
        // parse JSON object
        Map<String,Object> properties = new HashMap<>();
        Map<String,JsonObject> children = new LinkedHashMap<>();
        for (Map.Entry<String, JsonValue> entry : object.entrySet()) {
            String childName = entry.getKey();
            Object value = null;
            boolean ignore = false;
            try {
                value = convertValue(entry.getValue());
            }
            catch (ParseException ex) {
                if (helper.ignoreResource(childName) || helper.ignoreProperty(helper.cleanupPropertyName(childName))) {
                    ignore = true;
                }
                else {
                    throw ex;
                }
            }
            boolean isResource = (value instanceof JsonObject);
            if (!ignore) {
                if (isResource) {
                    ignore = helper.ignoreResource(childName);
                }
                else {
                    childName = helper.cleanupPropertyName(childName);
                    ignore = helper.ignoreProperty(childName);
                }
            }
            if (!ignore) {
                if (isResource) {
                    children.put(childName, (JsonObject)value);
                }
                else {
                    properties.put(childName, value);
                }
            }
        }
        helper.ensureDefaultPrimaryType(properties);
        
        // report current JSON object
        handler.resource(path, properties);
        
        // parse and report children
        for (Map.Entry<String,JsonObject> entry : children.entrySet()) {
            String childPath = helper.concatenatePath(path, entry.getKey());;
            parse(handler, entry.getValue(), childPath);
        }
    }