Detecting type JARRAY OR JOBJECT and Exception

Jun 23, 2011 at 2:28 PM

Is there a way to detect from a valid JSON string if i must one JARRAY or JOBJECT Parse?

I got the JObject.Parse : Exception : Error reading JObject from JsonReader item is not an object: StartArray

JArray.Parse work, but give me count = 1

This is my JSON string , which seem valid according to (http://jsonlint.com/):

[
    {
        "size": 28672,
        "sha1": "4d1740485713a2ab3a4f5822a01f645fe8387f92",
        "resource": "99017f6eebbac24f351415dd410d522d",
        "last-scan-permalink": "http://www.virustotal.com/file-scan/report.html?id=52d3df0ed60c46f336c131bf2ca454f73bafdc4b04dfa2aea80746f5ba9e6d1c-1273894724",
        "tags": [],
        "first-seen": "2010-04-10 09:34:59",
        "unique-submissions": 7,
        "last-seen": "2010-05-15 03:38.44",
        "filenames": [],
        "result": 1,
        "ssdeep": "96:ofjEbftIXFCERYC8g9rxMwKKrK9npmSOo/9eVp9LaiYkfclxhWWRD2evTB2:UWEWQrxMwKK+90oCXkhFdbB",
        "sha256": "52d3df0ed60c46f336c131bf2ca454f73bafdc4b04dfa2aea80746f5ba9e6d1c",
        "type": null,
        "last-scan-report": {
            "nProtect": [
                "Trojan.Generic.3611249",
                "2010-05-14.01",
                "20100514"
            ],
            "CAT-QuickHeal": [
                "Trojan.VB.acgy",
                "10.00",
                "20100514"
            ],
            "McAfee": [
                "Generic.dx!rkx",
                "5.400.0.1158",
                "20100515"
            ],
            "TheHacker": [
                "Trojan/VB.gen",
                "6.5.2.0.280",
                "20100514"
            ],
            "VirusBuster": [
                "Trojan.VB.JFDE",
                "5.0.27.0",
                "20100514"
            ],
            "NOD32": [
                "a variant of Win32/Qhost.NTY",
                "5115",
                "20100514"
            ],
            "F-Prot": [
                null,
                "4.5.1.85",
                "20100514"
            ],
            "Symantec": [
                "Trojan.KillAV",
                "20101.1.0.89",
                "20100515"
            ],
            "Norman": [
                "W32/Smalltroj.YFHZ",
                "6.04.12",
                "20100514"
            ],
            "TrendMicro-HouseCall": [
                "TROJ_VB.JVJ",
                "9.120.0.1004",
                "20100515"
            ],
            "Avast": [
                "Win32:Malware-gen",
                "4.8.1351.0",
                "20100514"
            ],
            "eSafe": [
                "Win32.TRVB.Acgy",
                "7.0.17.0",
                "20100513"
            ],
            "ClamAV": [
                null,
                "0.96.0.3-git",
                "20100514"
            ],
            "Kaspersky": [
                "Trojan.Win32.VB.acgy",
                "7.0.0.125",
                "20100515"
            ],
            "BitDefender": [
                "Trojan.Generic.3611249",
                "7.2",
                "20100515"
            ],
            "Comodo": [
                "Heur.Suspicious",
                "4842",
                "20100515"
            ],
            "F-Secure": [
                "Trojan.Generic.3611249",
                "9.0.15370.0",
                "20100514"
            ],
            "DrWeb": [
                "Trojan.Hosts.37",
                "5.0.2.03300",
                "20100515"
            ],
            "AntiVir": [
                "TR/VB.acgy.1",
                "8.2.1.242",
                "20100514"
            ],
            "TrendMicro": [
                "TROJ_VB.JVJ",
                "9.120.0.1004",
                "20100514"
            ],
            "McAfee-GW-Edition": [
                "Generic.dx!rkx",
                "2010.1",
                "20100515"
            ],
            "Sophos": [
                "Troj/VBHost-A",
                "4.53.0",
                "20100515"
            ],
            "eTrust-Vet": [
                "Win32/ASuspect.HDBBD",
                "35.2.7490",
                "20100515"
            ],
            "Authentium": [
                null,
                "5.2.0.5",
                "20100514"
            ],
            "Jiangmin": [
                "Trojan/VB.yqh",
                "13.0.900",
                "20100514"
            ],
            "Antiy-AVL": [
                "Trojan/Win32.VB.gen",
                "2.0.3.7",
                "20100514"
            ],
            "a-squared": [
                "Trojan.Win32.VB!IK",
                "4.5.0.50",
                "20100510"
            ],
            "Microsoft": [
                "Trojan:Win32/Comame",
                "1.5703",
                "20100514"
            ],
            "ViRobot": [
                "Trojan.Win32.VB.28672.CK",
                "2010.5.14.2316",
                "20100514"
            ],
            "GData": [
                "Trojan.Generic.3611249",
                "21",
                "20100515"
            ],
            "AhnLab-V3": [
                "Trojan/Win32.VB",
                "2010.05.15.00",
                "20100514"
            ],
            "VBA32": [
                "MAS.Trojan.VB.02121",
                "3.12.12.5",
                "20100514"
            ],
            "Sunbelt": [
                "Trojan.Win32.Generic!BT",
                "6304",
                "20100515"
            ],
            "PCTools": [
                "Voronezh.1600.A",
                "7.0.3.5",
                "20100515"
            ],
            "Rising": [
                null,
                "22.47.04.03",
                "20100514"
            ],
            "Ikarus": [
                "Trojan.Win32.VB",
                "T3.1.1.84.0",
                "20100514"
            ],
            "Fortinet": [
                "W32/Vb.HT!tr",
                "4.1.133.0",
                "20100514"
            ],
            "AVG": [
                "Generic17.ASTJ",
                "9.0.0.787",
                "20100514"
            ],
            "Panda": [
                "Adware/AccesMembre",
                "10.0.2.7",
                "20100514"
            ],
            "Avast5": [
                "Win32:Malware-gen",
                "5.0.332.0",
                "20100514"
            ]
        },
        "tool-info": {
            "prevx": "http://info.prevx.com/aboutprogramtext.asp?PX5=02215CAF005B938F70BE006977764E002A832771",
            "sigcheck": {
                "publisher": "TYV",
                "product": "Sin AV",
                "internal name": "nuevo4",
                "file version": "1.00",
                "original name": "nuevo4.exe"
            },
            "threatexpert": "http://www.threatexpert.com/report.aspx?md5=99017f6eebbac24f351415dd410d522d",
            "trid": "Win32 Executable Generic (68.0%)\u000aGeneric Win/DOS Executable (15.9%)\u000aDOS Executable Generic (15.9%)\u000aAutodesk FLIC Image File (extensions: flc, fli, cel) (0.0%)",
            "imports": {
                "msvbvm60.dll": [
                    "MethCallEngine",
                    "-",
                    "-",
                    "-",
                    "EVENT_SINK_AddRef",
                    "-",
                    "EVENT_SINK_Release",
                    "EVENT_SINK_QueryInterface",
                    "__vbaExceptHandler",
                    "-",
                    "-",
                    "ProcCallEngine",
                    "-",
                    "-",
                    "-"
                ]
            },
            "sections": [
                [
                    ".rsrc",
                    28672,
                    2240,
                    4096,
                    1.89,
                    "097934e2736d951fc52a6b1e15ad42f2"
                ],
                [
                    ".data",
                    24576,
                    2640,
                    0,
                    0,
                    "d41d8cd98f00b204e9800998ecf8427e"
                ],
                [
                    ".text",
                    4096,
                    16588,
                    20480,
                    3.94,
                    "681b80f1ee0eb1531df11c6ae115d711"
                ]
            ]
        },
        "md5": "99017f6eebbac24f351415dd410d522d"
    }
]