File size: 8,891 Bytes
318c7d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70f6e11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
defc62a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318c7d3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
TASKS = [
    {
        "name": "easy_syntax_fix",
        "difficulty": "easy",
        "description": "Fix basic JSON syntax error: trailing comma",
        "broken_json": '{"name": "Alice", "age": 30, "email": "alice@example.com",}',
        "correct_json": '{"name": "Alice", "age": 30, "email": "alice@example.com"}',
        "schema": {
            "type": "object",
            "required": ["name", "age", "email"],
            "properties": {
                "name": {"type": "string"},
                "age": {"type": "number"},
                "email": {"type": "string"}
            }
        },
        "hint": "Check for trailing commas before closing braces or brackets"
    },
    {
        "name": "medium_type_repair",
        "difficulty": "medium",
        "description": "Fix wrong field types and add missing required field",
        "broken_json": '{"user": "Bob", "score": "95", "active": "true"}',
        "correct_json": '{"user": "Bob", "score": 95, "active": true, "role": "user"}',
        "schema": {
            "type": "object",
            "required": ["user", "score", "active", "role"],
            "properties": {
                "user": {"type": "string"},
                "score": {"type": "number"},
                "active": {"type": "boolean"},
                "role": {"type": "string", "enum": ["admin", "user", "guest"]}
            }
        },
        "hint": "score should be a number not string, active should be boolean not string, role field is missing"
    },
    {
        "name": "hard_nested_reconstruction",
        "difficulty": "hard",
        "description": "Reconstruct heavily corrupted nested JSON with unquoted keys and wrong types",
        "broken_json": "{product: 'Laptop', price: '999.99', specs: {ram: '16gb', storage: 512}}",
        "correct_json": '{"product": "Laptop", "price": 999.99, "specs": {"ram": "16GB", "storage": 512}, "available": true}',
        "schema": {
            "type": "object",
            "required": ["product", "price", "specs", "available"],
            "properties": {
                "product": {"type": "string"},
                "price": {"type": "number"},
                "available": {"type": "boolean"},
                "specs": {
                    "type": "object",
                    "required": ["ram", "storage"],
                    "properties": {
                        "ram": {"type": "string"},
                        "storage": {"type": "number"}
                    }
                }
            }
        },
        "hint": "Quote all keys, fix price to number, add available field, normalize ram to uppercase, keep storage as number"
    },
    {
        "name": "extreme_multilevel_repair",
        "difficulty": "extreme",
        "description": "Fix deeply nested JSON with broken arrays, unquoted keys, and missing commas",
        "broken_json": "{'order_id': 1001, customer: { 'id': 'C-123', name: 'John Doe', contact: ['john@example.com', 1234567890 ] }, items: [ { sku: 'IT-01', qty: 2 price: 19.99 } { sku: 'IT-02', qty: 1, price: '45.00'}]",
        "correct_json": '{"order_id": 1001, "customer": {"id": "C-123", "name": "John Doe", "contact": ["john@example.com", "1234567890"]}, "items": [{"sku": "IT-01", "qty": 2, "price": 19.99}, {"sku": "IT-02", "qty": 1, "price": 45.00}]}',
        "schema": {
            "type": "object",
            "required": ["order_id", "customer", "items"],
            "properties": {
                "order_id": {"type": "integer"},
                "customer": {
                    "type": "object",
                    "required": ["id", "name", "contact"],
                    "properties": {
                        "id": {"type": "string"},
                        "name": {"type": "string"},
                        "contact": {"type": "array"}
                    }
                },
                "items": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "required": ["sku", "qty", "price"]
                    }
                }
            }
        },
        "hint": "Fix missing commas in the items array, quote all keys, ensure consistent contact types, and convert item prices to numbers."
    },
    {
        "name": "chaos_malformed_object",
        "difficulty": "chaos",
        "description": "Repair a chaotic object with mismatched brackets, unquoted text, and significant structural damage",
        "broken_json": "{ system_log: version: 2.0, events: [ { timestamp: 1700000000 level: ERROR msg: 'Auth failed' }, type: 'connection', info: { ip: 192.168.1.1, retry: true } status: 'FAIL' ",
        "correct_json": '{"system_log": {"version": "2.0", "events": [{"timestamp": 1700000000, "level": "ERROR", "msg": "Auth failed"}], "type": "connection", "info": {"ip": "192.168.1.1", "retry": true}, "status": "FAIL"}}',
        "schema": {
            "type": "object",
            "required": ["system_log"],
            "properties": {
                "system_log": {
                    "type": "object",
                    "required": ["version", "events", "type", "info", "status"]
                }
            }
        },
        "hint": "The events array is missing a closing bracket, the system_log structure is flat in the broken version but needs nesting, and multiple delimiters are missing."
    },
    {
        "name": "mixed_quote_nightmare",
        "difficulty": "hard",
        "description": "Fix a JSON containing mixed single quotes, double quotes, and unquoted keys",
        "broken_json": "{ \"title\": 'The Matrix', director: \"Wachowskis\", 'year': 1999, casting: [ 'Keanu', \"Laurence\", Carrie-Anne ] }",
        "correct_json": '{"title": "The Matrix", "director": "Wachowskis", "year": 1999, "casting": ["Keanu", "Laurence", "Carrie-Anne"]}',
        "schema": {
          "type": "object",
          "required": ["title", "director", "year", "casting"]
        },
        "hint": "Ensure all keys and string values use double quotes, and handle unquoted array elements."
    },
    {
        "name": "escaped_character_confusion",
        "difficulty": "extreme",
        "description": "Repair JSON with malformed escape sequences and control characters",
        "broken_json": '{"path": "C:\\\\Users\\\\Admin\\\\Documents", "message": "Line 1\\nLine 2\\tTabbed", "regex": "\\\d+\\\\\\.js"}',
        "correct_json": '{"path": "C:\\\\Users\\\\Admin\\\\Documents", "message": "Line 1\\nLine 2\\tTabbed", "regex": "\\\\d+\\\\\\\\.js"}',
        "schema": {
            "type": "object",
            "required": ["path", "message", "regex"]
        },
        "hint": "Handle backslash escaping correctly for Windows paths and Regex strings."
    },
    {
        "name": "truncated_stream_recovery",
        "difficulty": "chaos",
        "description": "Recover data from a JSON object that was truncated mid-transmission",
        "broken_json": '{"sensor_id": "WS-092", "readings": [ {"t": 171221, "v": 24.5}, {"t": 171222, "v": 24.6}, {"t": 171223, ',
        "correct_json": '{"sensor_id": "WS-092", "readings": [{"t": 171221, "v": 24.5}, {"t": 171222, "v": 24.6}]}',
        "schema": {
            "type": "object",
            "required": ["sensor_id", "readings"]
        },
        "hint": "The JSON ends abruptly. You must close the open object and array, discarding the partial element if necessary."
    },
    {
        "name": "deep_recursive_reconstruction",
        "difficulty": "extreme",
        "description": "Repair a deep hierarchy (5+ levels) with inconsistent naming and missing braces",
        "broken_json": "{ a: { b: { c: { d: { e: 'val', f: 10 } g: [1 2 3] h: { i: j } } } } }",
        "correct_json": '{"a": {"b": {"c": {"d": {"e": "val", "f": 10, "g": [1, 2, 3], "h": {"i": "j"}}}}}}',
        "schema": { "type": "object", "required": ["a"] },
        "hint": "Track nesting levels carefully to ensure every opening brace has a matching closing brace."
    },
    {
        "name": "data_type_normalization",
        "difficulty": "medium",
        "description": "Convert inconsistent data formats (dates, booleans in strings) to standard JSON types",
        "broken_json": '{"active": "YES", "count": "42", "verified": 0, "tags": "web,app,json"}',
        "correct_json": '{"active": true, "count": 42, "verified": false, "tags": ["web", "app", "json"]}',
        "schema": {
            "type": "object",
            "required": ["active", "count", "verified", "tags"],
            "properties": {
                "active": {"type": "boolean"},
                "count": {"type": "integer"},
                "verified": {"type": "boolean"},
                "tags": {"type": "array"}
            }
        },
        "hint": "Normalize 'YES' to true, '42' to integer 42, 0 to false, and the comma-separated string to an array."
    }
]