Skip to content

Commit a5ab04d

Browse files
All the conformance tests are passing
1 parent 36029a7 commit a5ab04d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/felipestanzani/jtoon/decoder/ValueDecoder.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,8 @@ private Object parseListItem(String content, int depth) {
695695
String value = itemContent.substring(colonIdx + 1).trim();
696696

697697
Map<String, Object> item = new LinkedHashMap<>();
698-
Object parsedValue = parseObjectItemValue(value, depth);
698+
// List item is at depth + 1, so pass depth + 1 to parseObjectItemValue
699+
Object parsedValue = parseObjectItemValue(value, depth + 1);
699700
item.put(key, parsedValue);
700701
parseListItemFields(item, depth);
701702

@@ -728,10 +729,10 @@ private Object parseObjectItemValue(String value, int depth) {
728729
}
729730

730731
// Handle empty value with nested content
731-
// The field is at depth + 1 (the list item is at depth, the field is indented
732-
// one more level)
733-
// So nested content should be at depth + 2 or greater
734-
if (isEmpty && nextDepth > depth + 1) {
732+
// The list item is at depth, and the field itself is conceptually at depth + 1
733+
// So nested content should be parsed with parentDepth = depth + 1
734+
// This allows nested fields at depth + 2 or deeper to be processed correctly
735+
if (isEmpty && nextDepth > depth) {
735736
return parseNestedObject(depth + 1);
736737
}
737738

0 commit comments

Comments
 (0)