Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deserialize a JSON Response from OrientDB in CSharp

I started testing OrientDB. I get the following JSON Response from the Demo Database:

{
    "schema":{
        "name":"OUser",
        "properties":{
            "roles":{
                "name":"roles",
                "linkedClass":"ORole",
                "type":"LINKSET",
                "mandatory":false,
                "notNull":true,
                "min":null,
                "max":null
            },
            "name":{
                "name":"name",
                "type":"STRING",
                "mandatory":true,
                "notNull":false,
                "min":null,
                "max":null
            },
            "password":{
                "name":"password",
                "type":"STRING",
                "mandatory":true,
                "notNull":false,
                "min":null,
                "max":null
            }
        }
    },
    "result":[
        {
            "@type":"d",
            "@rid":"#4:0",
            "@version":0,
            "@class":"OUser",
            "name":"admin",
            "password":"{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918",
            "status":"ACTIVE",
            "roles":[
                "#3:0"
            ]
        },
        {
            "@type":"d",
            "@rid":"#4:1",
            "@version":0,
            "@class":"OUser",
            "name":"reader",
            "password":"{SHA-256}3D0941964AA3EBDCB00CCEF58B1BB399F9F898465E9886D5AEC7F31090A0FB30",
            "status":"ACTIVE",
            "roles":[
                "#3:1"
            ]
        },
        {
            "@type":"d",
            "@rid":"#4:2",
            "@version":0,
            "@class":"OUser",
            "name":"writer",
            "password":"{SHA-256}B93006774CBDD4B299389A03AC3D88C3A76B460D538795BC12718011A909FBA5",
            "status":"ACTIVE",
            "roles":[
                "#3:2"
            ]
        }
    ]
}

How can you get a List of OUser Objects out of that? Using JSON.Net, JavaScriptSerializer or whatever?

like image 710
SuperTee Avatar asked Dec 20 '25 07:12

SuperTee


1 Answers

There are a number of json parsers for c# at: http://www.json.org/. It seems like fastJSON should be pretty quick.

like image 160
Asken Avatar answered Dec 23 '25 00:12

Asken



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!