{ "version": "1.4", "category": "decode", "description": "Object decoding - simple objects, nested objects, key parsing, quoted values", "tests": [ { "name": "parses objects with primitive values", "input": "id: 123\nname: Ada\nactive: true", "expected": { "id": 123, "name": "Ada", "active": true }, "specSection": "8" }, { "name": "parses null values in objects", "input": "id: 123\nvalue: null", "expected": { "id": 123, "value": null }, "specSection": "8" }, { "name": "parses empty nested object header", "input": "user:", "expected": { "user": {} }, "specSection": "8" }, { "name": "parses quoted object value with colon", "input": "note: \"a:b\"", "expected": { "note": "a:b" }, "specSection": "8" }, { "name": "parses quoted object value with comma", "input": "note: \"a,b\"", "expected": { "note": "a,b" }, "specSection": "8" }, { "name": "parses quoted object value with newline escape", "input": "text: \"line1\\nline2\"", "expected": { "text": "line1\nline2" }, "specSection": "8" }, { "name": "parses quoted object value with escaped quotes", "input": "text: \"say \\\"hello\\\"\"", "expected": { "text": "say \"hello\"" }, "specSection": "8" }, { "name": "parses quoted object value with leading/trailing spaces", "input": "text: \" padded \"", "expected": { "text": " padded " }, "specSection": "8" }, { "name": "parses quoted object value with only spaces", "input": "text: \" \"", "expected": { "text": " " }, "specSection": "8" }, { "name": "parses quoted string value that looks like true", "input": "v: \"true\"", "expected": { "v": "true" }, "specSection": "8" }, { "name": "parses quoted string value that looks like integer", "input": "v: \"42\"", "expected": { "v": "42" }, "specSection": "8" }, { "name": "parses quoted string value that looks like negative decimal", "input": "v: \"-7.5\"", "expected": { "v": "-7.5" }, "specSection": "8" }, { "name": "parses quoted key with colon", "input": "\"order:id\": 7", "expected": { "order:id": 7 }, "specSection": "8" }, { "name": "parses quoted key with brackets", "input": "\"[index]\": 5", "expected": { "[index]": 5 }, "specSection": "8" }, { "name": "treats extra brackets after valid array segment as literal key", "input": "foo[1][bar]: 10", "expected": { "foo[1][bar]": 10 }, "specSection": "6", "note": "Non-whitespace [bar] between ] and : prevents array header interpretation" }, { "name": "treats non-integer bracket content as literal key", "input": "foo[bar][1]: 20", "expected": { "foo[bar][1]": 20 }, "specSection": "6", "note": "[bar] fails integer parsing; line is not an array header" }, { "name": "treats text between bracket segment and colon as literal key", "input": "foo[2]extra: a,b", "expected": { "foo[2]extra": "a,b" }, "specSection": "6", "note": "Non-whitespace content between ] and : prevents array header interpretation" }, { "name": "parses quoted key with braces", "input": "\"{key}\": 5", "expected": { "{key}": 5 }, "specSection": "8" }, { "name": "parses quoted key with comma", "input": "\"a,b\": 1", "expected": { "a,b": 1 }, "specSection": "8" }, { "name": "parses quoted key with spaces", "input": "\"full name\": Ada", "expected": { "full name": "Ada" }, "specSection": "8" }, { "name": "parses quoted key with leading hyphen", "input": "\"-lead\": 1", "expected": { "-lead": 1 }, "specSection": "8" }, { "name": "parses quoted key with leading and trailing spaces", "input": "\" a \": 1", "expected": { " a ": 1 }, "specSection": "8" }, { "name": "parses quoted numeric key", "input": "\"123\": x", "expected": { "123": "x" }, "specSection": "8" }, { "name": "parses quoted empty string key", "input": "\"\": 1", "expected": { "": 1 }, "specSection": "8" }, { "name": "parses dotted keys as identifiers", "input": "user.name: Ada", "expected": { "user.name": "Ada" }, "specSection": "8" }, { "name": "parses underscore-prefixed keys", "input": "_private: 1", "expected": { "_private": 1 }, "specSection": "8" }, { "name": "parses underscore-containing keys", "input": "user_name: 1", "expected": { "user_name": 1 }, "specSection": "8" }, { "name": "unescapes newline in key", "input": "\"line\\nbreak\": 1", "expected": { "line\nbreak": 1 }, "specSection": "8" }, { "name": "unescapes tab in key", "input": "\"tab\\there\": 2", "expected": { "tab\there": 2 }, "specSection": "8" }, { "name": "unescapes quotes in key", "input": "\"he said \\\"hi\\\"\": 1", "expected": { "he said \"hi\"": 1 }, "specSection": "8" }, { "name": "parses deeply nested objects with indentation", "input": "a:\n b:\n c: deep", "expected": { "a": { "b": { "c": "deep" } } }, "specSection": "8" } ] }