Open Flash Chart 2 を使用するアプリを作成しています。このチャートは、特定の構造を持つ JSON を受け入れる Flash オブジェクトです。
"elements": [
{
"type": "bar_stack",
"colours": [
"#F19899",
"#A6CEE3"
],
"alpha": 1,
"on-show": {
"type": "grow-up",
"cascade": 1,
"delay": 0
},
...
次のように単純な匿名型を使用して JSON を返しています。
return Json(new
{
elements = new [] {
new
{
type = "bar_stack",
colours = colours.Take(variables.Count()),
alpha = 1,
on_show = new
{
type = "grow-up",
cascade = 1,
delay = 0
},
...
}
}
問題は、いくつかのプロパティ (「on-show」など) がダッシュを使用しており、明らかに C# コードでプロパティに名前を付けるときにダッシュを使用できないことです。
これを克服する方法はありますか?できれば、一連のクラス全体を宣言する必要はありません。