Share via


Deserialization of a json string returns null values

Question

Thursday, July 16, 2015 3:47 PM

I am trying to deserialize a json string. 

            string apiUrl = "http://data.posccaesar.org/rdl/?output=json&query=%23queryinterface%23%0APREFIX+owl:+%3Chttp:%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%0APREFIX+rdf:+%3Chttp:%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX+rdfs:++%3Chttp:%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0APREFIX+xsd:+%3Chttp:%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0APREFIX+fn:+%3Chttp:%2F%2Fwww.w3.org%2F2005%2Fxpath-functions%23%3E%0APREFIX+p2:+%3Chttp:%2F%2Frds.posccaesar.org%2F2008%2F02%2FOWL%2FISO-15926-2_2003%23%3E%0APREFIX+rds:+%3Chttp:%2F%2Frdl.rdlfacade.org%2Fdata%23%3E%0APREFIX+afn:+%3Chttp:%2F%2Fjena.hpl.hp.com%2FARQ%2Ffunction%23%3E%0APREFIX+dc:+%3Chttp:%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0A%0APREFIX+rdl:+%3Chttp:%2F%2Fdata.posccaesar.org%2Frdl%2F%3E%0APREFIX+ptrn:+%3Chttp:%2F%2Fdata.posccaesar.org%2Fptrn%2F%3E%0A%0Aselect+%3Fsub+%3Flabel+where+%7B%0A%09%3Fa+p2:hasSuperclass+rdl:RDS608876181+;%0A%09p2:hasSubclass+%3Fsub.%0A%09%3Fsub+rdfs:label+%3Flabel.%0A%7D%0Alimit+1000%0A";
            var jsonPayload = new { seriesid = new[] { "LAUCN040010000000005", "LAUCN040010000000006" } };
            string requestJson = JsonConvert.SerializeObject(jsonPayload);
            string responseJson = string.Empty;


            using (WebClient client = new WebClient())
            {
                //client.Headers[HttpRequestHeader.Accept] = "application/json";
                //client.Headers[HttpRequestHeader.ContentType] = "application/json";

                byte[] response = client.UploadData(apiUrl, Encoding.UTF8.GetBytes(requestJson));

                responseJson = Encoding.UTF8.GetString(response);
            }
            //datacontactjsondeserialiser

            RootObject gr = JsonConvert.DeserializeObject<RootObject>(responseJson);

            JavaScriptSerializer oJS = new JavaScriptSerializer();
            RootObject oRootObject = new RootObject();
            oRootObject = oJS.Deserialize<RootObject>(responseJson);

using System.Collections.Generic;
public class Graph
{
    public string @id { get; set; }
    public string @type { get; set; }
    public string defaultRdsId { get; set; }
    public string hasCreationDate { get; set; }
    public string hasCreator { get; set; }
    public string hasDefinition { get; set; }
    public string hasDesignation { get; set; }
    public string hasIdPCA { get; set; }
    public string hasStatus { get; set; }
    public string label { get; set; }
    public string sameAs { get; set; }
    public string hasDesignationAbbrev { get; set; }
    public string hasNote { get; set; }
    public string hasRegistrar { get; set; }
    public string hasRegistrarAuth { get; set; }
    public string hasSubclass { get; set; }
    public string hasSuperclass { get; set; }
    public string rdsWipEquivalent { get; set; }
}

public class SameAs
{
    public string @id { get; set; }
    public string @type { get; set; }
}

public class HasSuperclass
{
    public string @id { get; set; }
    public string @type { get; set; }
}

public class HasSubclass
{
    public string @id { get; set; }
    public string @type { get; set; }
}

public class RdsWipEquivalent
{
    public string @id { get; set; }
    public string @type { get; set; }
}

public class Context
{
    public string hasDesignation { get; set; }
    public string hasNote { get; set; }
    public string hasCreator { get; set; }
    public string hasDefinition { get; set; }
    public string label { get; set; }
    public string hasIdPCA { get; set; }
    public string hasCreationDate { get; set; }
    public string hasStatus { get; set; }
    public string defaultRdsId { get; set; }
    public string hasDesignationAbbrev { get; set; }
    public SameAs sameAs { get; set; }
    public HasSuperclass hasSuperclass { get; set; }
    public HasSubclass hasSubclass { get; set; }
    public string hasRegistrarAuth { get; set; }
    public string hasRegistrar { get; set; }
    public RdsWipEquivalent rdsWipEquivalent { get; set; }
    public string rds { get; set; }
    public string p2 { get; set; }
    public string owl { get; set; }
    public string rdf { get; set; }
    public string afn { get; set; }
    public string xsd { get; set; }
    public string fn { get; set; }
    public string oldrdl { get; set; }
    public string rdfs { get; set; }
    public string rdl { get; set; }
    public string list { get; set; }
    public string dc { get; set; }
}

public class RootObject
{
    public List<Graph> @graph { get; set; }
    public Context @context { get; set; }
}

My Json

{
  "@graph" : [ {
    "@id" : "rdl:RDS14186420",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R59065461445",
    "hasCreationDate" : "2003.10.30",
    "hasCreator" : "u83130",
    "hasDefinition" : "A component class whose members are classes of electrical heater components.",
    "hasDesignation" : "ELECTRICAL HEATER COMPONENT CLASS",
    "hasIdPCA" : "RDS14186420",
    "hasStatus" : "Recorded",
    "label" : "ELECTRICAL HEATER COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS14186420"
  }, {
    "@id" : "rdl:RDS15378839",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R36079680064",
    "hasCreationDate" : "2004.05.18",
    "hasCreator" : "u82237",
    "hasDefinition" : "A class whose members are intended to form part of a ship hull or other structural parts.",
    "hasDesignation" : "SHIP STRUCTURAL COMPONENT CLASS",
    "hasIdPCA" : "RDS15378839",
    "hasStatus" : "Recorded",
    "label" : "SHIP STRUCTURAL COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS15378839"
  }, {
    "@id" : "rdl:RDS17055682",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R90167534107",
    "hasCreationDate" : "2005.09.30",
    "hasCreator" : "u20683",
    "hasDefinition" : "Classes of machine components that forms part of of a drilling fluid powered downhole drilling motor.",
    "hasDesignation" : "DOWNHOLE DRILLING MOTOR COMPONENT CLASS",
    "hasIdPCA" : "RDS17055682",
    "hasStatus" : "Recorded",
    "label" : "DOWNHOLE DRILLING MOTOR COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS17055682"
  }, {
    "@id" : "rdl:RDS17056232",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R87192971881",
    "hasCreationDate" : "2005.11.08",
    "hasCreator" : "u20683",
    "hasDefinition" : "The class \"heat exchanger component class\" is the subclass of the class \"mechanical equipment class\" that contains each mechanical equipment component class for which each member can be a component of a heat exchanger.",
    "hasDesignation" : "HEAT EXCHANGER COMPONENT CLASS",
    "hasDesignationAbbrev" : "1705623200",
    "hasIdPCA" : "RDS17056232",
    "hasNote" : "A more informal definition is \"A heat exchanger component class is a heat transfer equipment component class that has members which can be components of a heat exchanger\".",
    "hasStatus" : "Incomplete",
    "label" : "HEAT EXCHANGER COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS17056232"
  }, {
    "@id" : "rdl:RDS17056700",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R36377127353",
    "hasCreationDate" : "2005.10.05",
    "hasCreator" : "u82237",
    "hasDefinition" : "A component class whose members are classes of parts of classes of process plant equipment.",
    "hasDesignation" : "EQUIPMENT COMPONENT CLASS",
    "hasIdPCA" : "RDS17056700",
    "hasStatus" : "Incomplete",
    "label" : "EQUIPMENT COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS17056700"
  }, {
    "@id" : "rdl:RDS201644",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R30951219061",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "A class whose members are classes of artefacts.",
    "hasDesignation" : "ARTEFACT CLASS",
    "hasIdPCA" : "RDS201644",
    "hasRegistrar" : "mvsen",
    "hasRegistrarAuth" : "RDS",
    "hasStatus" : "Qualified",
    "label" : "ARTEFACT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS201644"
  }, {
    "@id" : "rdl:RDS201914",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R58281768156",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "Classes of machine components that forms parts of a coupling.",
    "hasDesignation" : "POWER TRANSMISSION COUPLING COMPONENT CLASS",
    "hasIdPCA" : "RDS201914",
    "hasStatus" : "Recorded",
    "label" : "POWER TRANSMISSION COUPLING COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS201914"
  }, {
    "@id" : "rdl:RDS203399",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R51597621609",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "Classes of instrument components that forms parts of an instrument",
    "hasDesignation" : "INSTRUMENT COMPONENT CLASS",
    "hasIdPCA" : "RDS203399",
    "hasStatus" : "Recorded",
    "label" : "INSTRUMENT COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS203399"
  }, {
    "@id" : "rdl:RDS203489",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R15440214689",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "A heating, ventilation and air conditioning (HVAC) equipment class that contains classes of equipment used as parts of HVAC equipment",
    "hasDesignation" : "HVAC COMPONENT CLASS",
    "hasIdPCA" : "RDS203489",
    "hasStatus" : "Recorded",
    "label" : "HVAC COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS203489"
  }, {
    "@id" : "rdl:RDS203534",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R29782655361",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "A rotating mechanical equipment class that contains classes of machine components that forms parts of a pump.",
    "hasDesignation" : "PUMP COMPONENT CLASS",
    "hasIdPCA" : "RDS203534",
    "hasStatus" : "Recorded",
    "label" : "PUMP COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS203534"
  }, {
    "@id" : "rdl:RDS220589",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R39099110350",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "Classes of components that forms parts of a gearbox.",
    "hasDesignation" : "GEARBOX COMPONENT CLASS",
    "hasIdPCA" : "RDS220589",
    "hasStatus" : "Recorded",
    "label" : "GEARBOX COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS220589"
  }, {
    "@id" : "rdl:RDS224684",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R90018669619",
    "hasCreationDate" : "2005.10.25",
    "hasCreator" : "u83130",
    "hasDefinition" : "A valve equipment class that contains classes of valve components or parts used in pumps and pump assemblies. Only to be used during the classification of valves.",
    "hasDesignation" : "VALVE COMPONENT CLASS",
    "hasIdPCA" : "RDS224684",
    "hasStatus" : "Incomplete",
    "label" : "VALVE COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS224684"
  }, {
    "@id" : "rdl:RDS225314",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R60279376190",
    "hasCreationDate" : "2006.06.15",
    "hasCreator" : "u20683",
    "hasDefinition" : "A process piping equipment class that contains classes of equipment used in or in connection with a piping system.",
    "hasDesignation" : "PIPING COMPONENT CLASS",
    "hasIdPCA" : "RDS225314",
    "hasStatus" : "Recorded",
    "label" : "PIPING COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS225314"
  }, {
    "@id" : "rdl:RDS226124",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R20688513774",
    "hasCreationDate" : "2001.10.16",
    "hasCreator" : "u82237",
    "hasDefinition" : "Classes of components that forms parts of a mechanical seal.",
    "hasDesignation" : "MECHANICAL SEAL COMPONENT CLASS",
    "hasIdPCA" : "RDS226124",
    "hasStatus" : "Recorded",
    "label" : "MECHANICAL SEAL COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS226124"
  }, {
    "@id" : "rdl:RDS608876181",
    "@type" : "p2:ClassOfClassOfIndividual",
    "defaultRdsId" : "R63534165926",
    "hasCreationDate" : "2007.10.22",
    "hasCreator" : "mvsen",
    "hasDefinition" : "An artefact class whose members are suitable as a part of a larger artefact.",
    "hasDesignation" : "COMPONENT CLASS",
    "hasIdPCA" : "RDS608876181",
    "hasStatus" : "Incomplete",
    "label" : "COMPONENT CLASS",
    "sameAs" : "http://posccaesar.org/rdl/RDS608876181"
  }, {
    "@id" : "rdl:RDS608877101",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R29442817194",
    "hasIdPCA" : "RDS608877101",
    "hasSubclass" : "rdl:RDS608876181",
    "hasSuperclass" : "rdl:RDS201644",
    "sameAs" : "http://posccaesar.org/rdl/RDS608877101"
  }, {
    "@id" : "rdl:RDS608880141",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R72593201380",
    "hasIdPCA" : "RDS608880141",
    "hasSubclass" : "rdl:RDS14186420",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS608880141"
  }, {
    "@id" : "rdl:RDS609008651",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R61353051370",
    "hasIdPCA" : "RDS609008651",
    "hasSubclass" : "rdl:RDS17055682",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609008651"
  }, {
    "@id" : "rdl:RDS609008911",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R72794538375",
    "hasIdPCA" : "RDS609008911",
    "hasSubclass" : "rdl:RDS17056700",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609008911"
  }, {
    "@id" : "rdl:RDS609009131",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R91377360705",
    "hasIdPCA" : "RDS609009131",
    "hasSubclass" : "rdl:RDS220589",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609009131"
  }, {
    "@id" : "rdl:RDS609009331",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R68426307879",
    "hasIdPCA" : "RDS609009331",
    "hasSubclass" : "rdl:RDS17056232",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609009331"
  }, {
    "@id" : "rdl:RDS609009541",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R55261332198",
    "hasIdPCA" : "RDS609009541",
    "hasSubclass" : "rdl:RDS203489",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609009541"
  }, {
    "@id" : "rdl:RDS609009681",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R10066878943",
    "hasIdPCA" : "RDS609009681",
    "hasSubclass" : "rdl:RDS203399",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609009681"
  }, {
    "@id" : "rdl:RDS609009931",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R91203774026",
    "hasIdPCA" : "RDS609009931",
    "hasSubclass" : "rdl:RDS226124",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609009931"
  }, {
    "@id" : "rdl:RDS609011171",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R58289922054",
    "hasIdPCA" : "RDS609011171",
    "hasSubclass" : "rdl:RDS225314",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609011171"
  }, {
    "@id" : "rdl:RDS609011401",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R40124754568",
    "hasIdPCA" : "RDS609011401",
    "hasSubclass" : "rdl:RDS201914",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609011401"
  }, {
    "@id" : "rdl:RDS609011651",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R65525751798",
    "hasIdPCA" : "RDS609011651",
    "hasSubclass" : "rdl:RDS203534",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609011651"
  }, {
    "@id" : "rdl:RDS609011921",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R35776609616",
    "hasIdPCA" : "RDS609011921",
    "hasSubclass" : "rdl:RDS15378839",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609011921"
  }, {
    "@id" : "rdl:RDS609012311",
    "@type" : "p2:Specialization",
    "defaultRdsId" : "R91523122738",
    "hasIdPCA" : "RDS609012311",
    "hasSubclass" : "rdl:RDS224684",
    "hasSuperclass" : "rdl:RDS608876181",
    "sameAs" : "http://posccaesar.org/rdl/RDS609012311"
  }, {
    "@id" : "rds:R63534165926",
    "rdsWipEquivalent" : "rdl:RDS608876181"
  } ],
  "@context" : {
    "hasDesignation" : "http://data.posccaesar.org/rdl/hasDesignation",
    "hasNote" : "http://data.posccaesar.org/rdl/hasNote",
    "hasCreator" : "http://data.posccaesar.org/rdl/hasCreator",
    "hasDefinition" : "http://data.posccaesar.org/rdl/hasDefinition",
    "label" : "http://www.w3.org/2000/01/rdf-schema#label",
    "hasIdPCA" : "http://data.posccaesar.org/rdl/hasIdPCA",
    "hasCreationDate" : "http://data.posccaesar.org/rdl/hasCreationDate",
    "hasStatus" : "http://data.posccaesar.org/rdl/hasStatus",
    "defaultRdsId" : "http://data.posccaesar.org/rdl/defaultRdsId",
    "hasDesignationAbbrev" : "http://data.posccaesar.org/rdl/hasDesignationAbbrev",
    "sameAs" : {
      "@id" : "http://www.w3.org/2002/07/owl#sameAs",
      "@type" : "@id"
    },
    "hasSuperclass" : {
      "@id" : "http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasSuperclass",
      "@type" : "@id"
    },
    "hasSubclass" : {
      "@id" : "http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#hasSubclass",
      "@type" : "@id"
    },
    "hasRegistrarAuth" : "http://data.posccaesar.org/rdl/hasRegistrarAuth",
    "hasRegistrar" : "http://data.posccaesar.org/rdl/hasRegistrar",
    "rdsWipEquivalent" : {
      "@id" : "http://data.posccaesar.org/rdl/rdsWipEquivalent",
      "@type" : "@id"
    },
    "rds" : "http://rdl.rdlfacade.org/data#",
    "p2" : "http://rds.posccaesar.org/2008/02/OWL/ISO-15926-2_2003#",
    "owl" : "http://www.w3.org/2002/07/owl#",
    "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "afn" : "http://jena.hpl.hp.com/ARQ/function#",
    "xsd" : "http://www.w3.org/2001/XMLSchema#",
    "fn" : "http://www.w3.org/2005/xpath-functions#",
    "oldrdl" : "http://rds.posccaesar.org/2008/06/OWL/RDL#",
    "rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
    "rdl" : "http://data.posccaesar.org/rdl/",
    "list" : "http://www.co-ode.org/ontologies/list.owl#",
    "dc" : "http://purl.org/dc/elements/1.1/"
  }
}

The classes would generated with: http://jsonutils.com/

Why is it null?

All replies (6)

Friday, July 17, 2015 8:30 AM âś…Answered | 2 votes

Hi TaMBeY,

I've tested your code, but I got different JSON string with yours.

The following is my test JSON string.

{
  "head": {
    "vars": [ "sub" , "label" ]
  } ,
  "results": {
    "bindings": [
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS225314" } ,
        "label": { "type": "literal" , "value": "PIPING COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS226124" } ,
        "label": { "type": "literal" , "value": "MECHANICAL SEAL COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS15378839" } ,
        "label": { "type": "literal" , "value": "SHIP STRUCTURAL COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS14186420" } ,
        "label": { "type": "literal" , "value": "ELECTRICAL HEATER COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS203489" } ,
        "label": { "type": "literal" , "value": "HVAC COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS224684" } ,
        "label": { "type": "literal" , "value": "VALVE COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS17056232" } ,
        "label": { "type": "literal" , "value": "HEAT EXCHANGER COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS203534" } ,
        "label": { "type": "literal" , "value": "PUMP COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS17056700" } ,
        "label": { "type": "literal" , "value": "EQUIPMENT COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS220589" } ,
        "label": { "type": "literal" , "value": "GEARBOX COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS17055682" } ,
        "label": { "type": "literal" , "value": "DOWNHOLE DRILLING MOTOR COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS201914" } ,
        "label": { "type": "literal" , "value": "POWER TRANSMISSION COUPLING COMPONENT CLASS" }
      } ,
      {
        "sub": { "type": "uri" , "value": "http://data.posccaesar.org/rdl/RDS203399" } ,
        "label": { "type": "literal" , "value": "INSTRUMENT COMPONENT CLASS" }
      }
    ]
  }

After generate class from http://json2csharp.com/ I got as below.

Note: I also try to generate from the link as you posted but with different result.

  public class Head
    {
        public List<string> vars { get; set; }
    }

    public class Sub
    {
        public string type { get; set; }
        public string value { get; set; }
    }

    public class Label
    {
        public string type { get; set; }
        public string value { get; set; }
    }

    public class Binding
    {
        public Sub sub { get; set; }
        public Label label { get; set; }
    }

    public class Results
    {
        public List<Binding> bindings { get; set; }
    }

    public class RootObject
    {
        public Head head { get; set; }
        public Results results { get; set; }
    }

My test result: head and results

*Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. *

Microsoft does not control these sites and has not tested any software or information found on these sites;

Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

Best regards,

Kristin

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.


Thursday, July 16, 2015 5:44 PM | 1 vote

JsonConvert is not a Microsoft product.It is open source and has a dedicated support forum.

While the documentation appears to follow the basic style of the .NET Framework classs, stuff like behavior or thrown exceptions are omited:

http://www.newtonsoft.com/json/help/html/Overload_Newtonsoft_Json_JsonConvert_DeserializeObject.htm

So my guess is as good as yours.

Have you checked if JsonResponse is actually set to something? For all we know it never is given a value besides String.Empty.
And that JSON you posted seems like it was captured another way, like webbrowser. Could be there is some cookie or other login information set in the browser that is not properly imitated by your code.


Monday, July 20, 2015 7:27 AM

Thank you Kristin Xie.

Why is the generated class different?

And can you show me your generated classes.


Monday, July 20, 2015 7:37 AM

Thank you Kristin Xie.

Why is the generated class different?

And can you show me your generated classes.

@TaMBeY

Both of them are third-party links. I am afraid this is out of our support scope.

And the classes I have already posted above behind the "Note" line. You also can generate by yourself.

Here is a similar thread, please refer to  json newtonsoft : Deserialize Object containing a list of string for more details.

You may need to know the theory of Deserialize JSON with C#

Best regards,

kristin

 

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.


Monday, July 20, 2015 8:46 AM

JsonConvert is not a Microsoft product.It is open source and has a dedicated support forum.

While the documentation appears to follow the basic style of the .NET Framework classs, stuff like behavior or thrown exceptions are omited:

http://www.newtonsoft.com/json/help/html/Overload_Newtonsoft_Json_JsonConvert_DeserializeObject.htm

So my guess is as good as yours.

Have you checked if JsonResponse is actually set to something? For all we know it never is given a value besides String.Empty.
And that JSON you posted seems like it was captured another way, like webbrowser. Could be there is some cookie or other login information set in the browser that is not properly imitated by your code.

Thank you Christopher. How can I fix this error?


Monday, July 20, 2015 10:05 AM

Thank you Kristin Xie.

Why is the generated class different?

And can you show me your generated classes.

@TaMBeY

Both of them are third-party links. I am afraid this is out of our support scope.

And the classes I have already posted above behind the "Note" line. You also can generate by yourself.

Here is a similar thread, please refer to  json newtonsoft : Deserialize Object containing a list of string for more details.

You may need to know the theory of Deserialize JSON with C#

Best regards,

kristin

 

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.

Thank you Kristin. The Problem was the Auto-generated Class.