0
我有一個像下面動態ID和特殊字符
{
"!type": "alarm",
"$": {
"12279": {
"!type": "alarm",
"title": "Default",
"$": {
"5955": {
"!type": "alarm",
"name": "Wake",
"day": "SUN",
"startTime": "06:00"
},
"29323": {
"!type": "alarm",
"name": "Away",
"day": "SUN",
"startTime": "08:00"
},
"2238": {
"!type": "alarm",
"name": "Home",
"day": "SUN",
"startTime": "18:00"
}
}
}
}
}
我FBS看起來像這樣
namespace space.alarm;
table Atom{
!type:string;
name:string;
startDay:string;
startTime:string; }
table AtomShell{
key:string (required, key);
value: Atom; }
table Alarm{
!type:string;
title:string;
$:[AtomShell]; }
table AlarmShell{
key:string (required, key);
value:Alarm; }
table Weeklyalarm{
!type:string;
$:[AlarmShell]; } root_type Weeklyalarm;
我試着去實現谷歌JSON數據平緩衝區,但我得到錯誤,如
- alarm.fbs:4:0:錯誤:非法字符:!
- alarm.fbs:23:0:error:illegal character:$(我已經刪除!從 !類型並將$更改爲美元來測試平緩衝區的工作 但我無法更改動態ID)
- Sample.json:25:0:錯誤:未知的領域:12279
現在我的問題,
- 是否有可能在平板緩衝區使用動態的ID,如果可能的話如何0應我繼續?
- 可以在ID中使用特殊字符,如果可能的話該怎麼做?
在此先感謝。