私は C# (ASP) で jSon 解析を行っています。問題は、klout からの JSON が非常に複雑な場合、これが応答になることです。
{"myInfluencers":[{"entity":{"id":"851563","payload":{"kloutId":"851563","nick":"YouTube","score":{"score":100.0},"scoreDeltas":{"dayChange":0.0,"weekChange":0.0,"monthChange":0.0}}}},{"entity":{"id":"100768049884337217","payload":{"kloutId":"100768049884337217","nick":"JessicaBiel","score":{"score":65.81697082519531}}}},{"entity":{"id":"879345","payload":{"kloutId":"879345","nick":"brokemogul","score":{"score":65.55970764160156},"scoreDeltas":{"dayChange":-0.2452850341796875,"weekChange":-0.6857528686523438,"monthChange":-2.5359420776367188}}}},{"entity":{"id":"25332752669424610","payload":{"kloutId":"25332752669424610","nick":"EsteeStanley","score":{"score":64.1717529296875}}}},{"entity":{"id":"28710452389286536","payload":{"kloutId":"28710452389286536","nick":"robknox_ys","score":{"score":60.353816986083984}}}}],"myInfluencees":[{"entity":{"id":"98516250154496343","payload":{"kloutId":"98516250154496343","nick":"LYNASXD","score":{"score":14.632675170898438}}}},{"entity":{"id":"42784201225370648","payload":{"kloutId":"42784201225370648","nick":"JenThackray","score":{"score":14.392120361328125}}}},{"entity":{"id":"52635827290381715","payload":{"kloutId":"52635827290381715","nick":"JTChile","score":{"score":13.279963493347168}}}},{"entity":{"id":"60235650788244656","payload":{"kloutId":"60235650788244656","nick":"upallnight356","score":{"score":11.61323070526123}}}},{"entity":{"id":"97108875505882083","payload":{"kloutId":"97108875505882083","nick":"anisahmutiahna","score":{"score":10.5490140914917}}}}],"myInfluencersCount":14,"myInfluenceesCount":25}
生成されるクラスは次のとおりです。
public class Score
{
public double score { get; set; }
}
public class ScoreDeltas
{
public double dayChange { get; set; }
public double weekChange { get; set; }
public double monthChange { get; set; }
}
public class Payload
{
public string kloutId { get; set; }
public string nick { get; set; }
public Score score { get; set; }
public ScoreDeltas scoreDeltas { get; set; }
}
public class Entity
{
public string id { get; set; }
public Payload payload { get; set; }
}
public class MyInfluencer
{
public Entity entity { get; set; }
}
public class Score2
{
public double score { get; set; }
}
public class Payload2
{
public string kloutId { get; set; }
public string nick { get; set; }
public Score2 score { get; set; }
}
public class Entity2
{
public string id { get; set; }
public Payload2 payload { get; set; }
}
public class MyInfluencee
{
public Entity2 entity { get; set; }
}
public class RootObject
{
public List<MyInfluencer> myInfluencers { get; set; }
public List<MyInfluencee> myInfluencees { get; set; }
public int myInfluencersCount { get; set; }
public int myInfluenceesCount { get; set; }
}
結果をグリッドビューにバインドしたい.JSON.NETを使用しても、1つずつ抽出することはできませんdeserialize
.前に使用しましたが、ここではシーンがネストされすぎています. これを解決する良い方法を見つけるのを手伝ってくれる人は誰でも.