{
    "description": "Top-level document validity",
    "bson_type": "0x00",
    "valid": [
        {
            "description": "Dollar-prefixed key in top-level document",
            "canonical_bson": "0F00000010246B6579002A00000000",
            "canonical_extjson": "{\"$key\": {\"$numberInt\": \"42\"}}"
        },
        {
            "description": "Dollar as key in top-level document",
            "canonical_bson": "0E00000002240002000000610000",
            "canonical_extjson": "{\"$\": \"a\"}"
        },
        {
            "description": "Dotted key in top-level document",
            "canonical_bson": "1000000002612E620002000000630000",
            "canonical_extjson": "{\"a.b\": \"c\"}"
        },
        {
            "description": "Dot as key in top-level document",
            "canonical_bson": "0E000000022E0002000000610000",
            "canonical_extjson": "{\".\": \"a\"}"
        }
    ],
    "decodeErrors": [
        {
            "description": "An object size that's too small to even include the object size, but is a well-formed, empty object",
            "bson": "0100000000"
        },
        {
            "description": "An object size that's only enough for the object size, but is a well-formed, empty object",
            "bson": "0400000000"
        },
        {
            "description": "One object, with length shorter than size (missing EOO)",
            "bson": "05000000"
        },
        {
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x01",
            "bson": "0500000001"
        },
        {
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0xff",
            "bson": "05000000FF"
        },
        {
            "description": "One object, sized correctly, with a spot for an EOO, but the EOO is 0x70",
            "bson": "0500000070"
        },
        {
            "description": "Byte count is zero (with non-zero input length)",
            "bson": "00000000000000000000"
        },
        {
            "description": "Stated length exceeds byte count, with truncated document",
            "bson": "1200000002666F6F0004000000626172"
        },
        {
            "description": "Stated length less than byte count, with garbage after envelope",
            "bson": "1200000002666F6F00040000006261720000DEADBEEF"
        },
        {
            "description": "Stated length exceeds byte count, with valid envelope",
            "bson": "1300000002666F6F00040000006261720000"
        },
        {
            "description": "Stated length less than byte count, with valid envelope",
            "bson": "1100000002666F6F00040000006261720000"
        },
        {
            "description": "Invalid BSON type low range",
            "bson": "07000000000000"
        },
        {
            "description": "Invalid BSON type high range",
            "bson": "07000000800000"
        },
        {
            "description": "Document truncated mid-key",
            "bson": "1200000002666F"
        },
        {
            "description": "Null byte in document key",
            "bson": "0D000000107800000100000000"
        }
    ],
    "parseErrors": [
        {
            "description" : "Bad $regularExpression (extra field)",
            "string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}"
        },
        {
            "description" : "Bad $regularExpression (missing options field)",
            "string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\"}}}"
        },
        {
            "description": "Bad $regularExpression (pattern is number, not string)",
            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": 42, \"$options\" : \"\"}}}"
        },
        {
            "description": "Bad $regularExpression (options are number, not string)",
            "string": "{\"x\" : {\"$regularExpression\" : { \"pattern\": \"a\", \"$options\" : 0}}}"
        },
        {
            "description" : "Bad $regularExpression (missing pattern field)",
            "string" : "{\"a\" : {\"$regularExpression\": {\"options\":\"ix\"}}}"
        },
        {
            "description": "Bad $oid (number, not string)",
            "string": "{\"a\" : {\"$oid\" : 42}}"
        },
        {
            "description": "Bad $oid (extra field)",
            "string": "{\"a\" : {\"$oid\" : \"56e1fc72e0c917e9c4714161\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $numberInt (number, not string)",
            "string": "{\"a\" : {\"$numberInt\" : 42}}"
        },
        {
            "description": "Bad $numberInt (extra field)",
            "string": "{\"a\" : {\"$numberInt\" : \"42\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $numberLong (number, not string)",
            "string": "{\"a\" : {\"$numberLong\" : 42}}"
        },
        {
            "description": "Bad $numberLong (extra field)",
            "string": "{\"a\" : {\"$numberLong\" : \"42\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $numberDouble (number, not string)",
            "string": "{\"a\" : {\"$numberDouble\" : 42}}"
        },
        {
            "description": "Bad $numberDouble (extra field)",
            "string": "{\"a\" : {\"$numberDouble\" : \".1\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $numberDecimal (number, not string)",
            "string": "{\"a\" : {\"$numberDecimal\" : 42}}"
        },
        {
            "description": "Bad $numberDecimal (extra field)",
            "string": "{\"a\" : {\"$numberDecimal\" : \".1\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $binary (binary is number, not string)",
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : 0, \"subType\" : \"00\"}}}"
        },
        {
            "description": "Bad $binary (type is number, not string)",
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"\", \"subType\" : 0}}}"
        },
        {
            "description": "Bad $binary (missing $type)",
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\"}}}"
        },
        {
            "description": "Bad $binary (missing $binary)",
            "string": "{\"x\" : {\"$binary\" : {\"subType\" : \"00\"}}}"
        },
        {
            "description": "Bad $binary (extra field)",
            "string": "{\"x\" : {\"$binary\" : {\"base64\" : \"//8=\", \"subType\" : 0, \"unrelated\": true}}}"
        },
        {
            "description": "Bad $code (type is number, not string)",
            "string": "{\"a\" : {\"$code\" : 42}}"
        },
        {
            "description": "Bad $code (type is number, not string) when $scope is also present",
            "string": "{\"a\" : {\"$code\" : 42, \"$scope\" : {}}}"
        },
        {
            "description": "Bad $code (extra field)",
            "string": "{\"a\" : {\"$code\" : \"\", \"unrelated\": true}}"
        },
        {
            "description": "Bad $code with $scope (scope is number, not doc)",
            "string": "{\"x\" : {\"$code\" : \"\", \"$scope\" : 42}}"
        },
        {
            "description": "Bad $timestamp (type is number, not doc)",
            "string": "{\"a\" : {\"$timestamp\" : 42} }"
        },
        {
            "description": "Bad $timestamp ('t' type is string, not number)",
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : 42} } }"
        },
        {
            "description": "Bad $timestamp ('i' type is string, not number)",
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : \"42\"} } }"
        },
        {
            "description": "Bad $timestamp (extra field at same level as $timestamp)",
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\"}, \"unrelated\": true } }"
        },
        {
            "description": "Bad $timestamp (extra field at same level as t and i)",
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\", \"i\" : \"42\", \"unrelated\": true} } }"
        },
        {
            "description": "Bad $timestamp (missing t)",
            "string": "{\"a\" : {\"$timestamp\" : {\"i\" : \"42\"} } }"
        },
        {
            "description": "Bad $timestamp (missing i)",
            "string": "{\"a\" : {\"$timestamp\" : {\"t\" : \"123456789\"} } }"
        },
        {
            "description": "Bad $date (number, not string or hash)",
            "string": "{\"a\" : {\"$date\" : 42}}"
        },
        {
            "description": "Bad $date (extra field)",
            "string": "{\"a\" : {\"$date\" : {\"$numberLong\" : \"1356351330501\"}, \"unrelated\": true}}"
        },
        {
            "description": "Bad $minKey (boolean, not integer)",
            "string": "{\"a\" : {\"$minKey\" : true}}"
        },
        {
            "description": "Bad $minKey (wrong integer)",
            "string": "{\"a\" : {\"$minKey\" : 0}}"
        },
        {
            "description": "Bad $minKey (extra field)",
            "string": "{\"a\" : {\"$minKey\" : 1, \"unrelated\": true}}"
        },
        {
            "description": "Bad $maxKey (boolean, not integer)",
            "string": "{\"a\" : {\"$maxKey\" : true}}"
        },
        {
            "description": "Bad $maxKey (wrong integer)",
            "string": "{\"a\" : {\"$maxKey\" : 0}}"
        },
        {
            "description": "Bad $maxKey (extra field)",
            "string": "{\"a\" : {\"$maxKey\" : 1, \"unrelated\": true}}"
        },
        {
            "description": "Bad DBpointer (extra field)",
            "string": "{\"a\": {\"$dbPointer\": {\"a\": {\"$numberInt\": \"1\"}, \"$id\": {\"$oid\": \"56e1fc72e0c917e9c4714161\"}, \"c\": {\"$numberInt\": \"2\"}, \"$ref\": \"b\"}}}"
        },
        {
            "description" : "Null byte in document key",
            "string" : "{\"a\\u0000\": 1 }"
        },
        {
            "description" : "Null byte in sub-document key",
            "string" : "{\"a\" : {\"b\\u0000\": 1 }}"
        },
        {
            "description": "Null byte in $regularExpression pattern",
            "string": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"b\\u0000\", \"options\" : \"i\"}}}"
        },
        {
            "description": "Null byte in $regularExpression options",
            "string": "{\"a\" : {\"$regularExpression\" : { \"pattern\": \"b\", \"options\" : \"i\\u0000\"}}}"
        }
    ]
}
