2

I was trying to parse the following string from Python into Java Object, but the Java Object that I have created for it shows the properties as null I could see the id part of it not the other properties.

Please find the Java Class below:

public String getId()
{
    return id;
}

public void setId(String id)
{
    this.id = id;
}
@JsonProperty("remote-system-desc")
public String getRemote_system_desc()
{
    return remote_system_desc;
}

@JsonProperty("remote-system-desc")
public void setRemote_system_desc(String remote_system_desc)
{
    this.remote_system_desc = remote_system_desc;
}
@JsonProperty("remote-system-capabilities")
public String getRemote_system_capabilities()
{
    return remote_system_capabilities;
}

@JsonProperty("remote-system-capabilities")
public void setRemote_system_capabilities(String remote_system_capabilities)
{
    this.remote_system_capabilities = remote_system_capabilities;
}

@JsonProperty("remote-chassis-id")
public String getRemote_chassis_id()
{
    return remote_chassis_id;
}

@JsonProperty("remote-chassis-id")
public void setRemote_chassis_id(String remote_chassis_id)
{
    this.remote_chassis_id = remote_chassis_id;
}

public List<ExternalSwitchPort> getPorts()
{
    return ports;
}

public void setPorts(List<ExternalSwitchPort> ports)
{
    this.ports = ports;
}
@JsonProperty("remote-system-name")
public String getRemote_system_name()
{
    return remote_system_name;
}

@JsonProperty("remote-system-name")
public void setRemote_system_name(String remote_system_name)
{
    this.remote_system_name = remote_system_name;
}

"externalSwitches": [{"id": "00:15:60:00:eb:80", "remote-system-desc": "ProCurve J4904A Switch 2848, revision I.10.77, ROM I.08.07 (/sw/code/build/mako(mkfs))", "remote-system-capabilities": "bridge,router", "remote-chassis-id": "00:15:60:00:eb:80", "ports": [{"remote-port-desc": "33", "id": "enc0:iobay2:X5", "remote-port-id": "33"}], "remote-system-name": "VirtSW Rack9"}, {"id": "00:13:21:dd:35:00", "remote-system-desc": "ProCurve J4904A Switch 2848, revision I.10.77, ROM I.08.07 (/sw/code/build/mako(mkfs))", "remote-system-capabilities": "bridge,router", "remote-chassis-id": "00:13:21:dd:35:00", "ports": [{"remote-port-desc": "19", "id": "enc0:iobay1:X5", "remote-port-id": "19"}], "remote-system-name": "swr5-hpqcorp"}]}

I am not able to find out whether it's due to the data content or because it's not able to properly parse the properties remote-system-desc but I have mentioned that in the JSON property.

4

0 回答 0