1

2週間解決策がないため、問題の解決策を探しています。JSON.NETでJSONをデシリアライズしたいのですが、いまいち…

クラスを作成しますが、オブジェクトを逆シリアル化すると空のままになります (何もありません)。

ここで JSON :

{"plannifReponse":
{"@competence":"Abonnement","plannifDonnees":
{"entry":
[
{"key":"2013-8-11T00:00","value":
{"creneaux":
[
{"@jour":"2013-8-11T00:00","@heure":"09","@minute":"30","nombreRessources":10},
{"@jour":"2013-8-11T00:00","@heure":"10","@minute":"30","nombreRessources":2},
{"@jour":"2013-8-11T00:00","@heure":"17","@minute":"30","nombreRessources":5},
{"@jour":"2013-8-11T00:00","@heure":"20","@minute":"30","nombreRessources":5},
{"@jour":"2013-8-11T00:00","@heure":"21","@minute":"00","nombreRessources":16}
]
}
},
{"key":"2013-7-30T00:00","value":
{"creneaux":
[{"@jour":"2013-7-30T00:00","@heure":"12","@minute":"00","nombreRessources":4},{"@jour":"2013-7-30T00:00","@heure":"12","@minute":"15","nombreRessources":10},{"@jour":"2013-7-30T00:00","@heure":"12","@minute":"30","nombreRessources":3},{"@jour":"2013-7-30T00:00","@heure":"14","@minute":"00","nombreRessources":8},{"@jour":"2013-7-30T00:00","@heure":"18","@minute":"30","nombreRessources":10}]}}]}}}

このために、そのクラスで翻訳します:

Public Class plannifReponse
    Public competence As String
    Public plannifDonnees As Dictionary(Of String, ListCreneaux)
End Class

Public Class ListCreneaux
    Public listCreneaux() As Creneau
End Class

Public Class Creneau
    Public jour As String
    Public heure As String
    Public minute As String
    Public nombreRessources As Integer
    Public Sub New(ByVal _jour, ByVal _heure, ByVal _minute, ByVal _nombreRessources)
        jour = _jour
        heure = _heure
        minute = _minute
        nombreRessources = _nombreRessources
    End Sub
End Class

そしてコード:

Dim prev As plannifReponse = JsonConvert.DeserializeObject(Of plannifReponse)(My_dispos)

しかし、それは機能しません。エラーメッセージはありませんが、前の「何もありません」のままです

参考までに、シリアル化に使用するソース オブジェクトを次に示します (Java 上にあります)。

public class OutputPlannif {
    private String competence;
    private HashMap<String, ListCreneaux> plannifDonnees;
}

public class ListCreneaux {
    private ArrayList<Creneau> listCrenaux;
}

public class Creneau {
    private String jour;
    private String heure;
    private String minute;
    private int nombreRessources;
}

誰かがアイデアを持っているなら...ありがとうマット

4

1 に答える 1