最近寫mysql 發現 原來 mysql 在json內容時,也有支援一些操作
https://www.cnblogs.com/chuanzhang053/p/9139624.html
https://medium.com/micheh/%E5%9C%A8-mysql-%E4%BD%BF%E7%94%A8-json-5796a65701ad 再加上 mysql 還有另一個譆能 虛疑欄位 GENERATED ALWAYS AS
http://blog.changyy.org/2017/09/mysql-json-mysql-57.html
基本上可以把json內的某欄位值當成 virutal colume, 直接輸出 覺得這樣可以玩出很多變化 https://www.cnblogs.com/waterystone/p/5626098.html
Very Important!
{"107年工作":{"zhangqi":[{"name":"王大明1"},{"name":"孫小明1"}],"chaojiangeren":[{"name":"nnn1","addr":"aaa1"},{"name":"nnn2","addr":"aaa2"}]},"108年法會":{"zhangqi":[{"name":"王大明1"},{"name":"孫小明1"}]}} zhangqi : [ …. ]
chaojiangeren: [ …. ]
zhangqi : [ {….}, {….} ]
chaojiangeren: [ {….}, {….} ]
Can’t have \' or \" If have this, json.decode can’t List List=> ListList=> List List<ItemName> zhangqi = List<ItemName>(); zhangqi.add(new ItemName(name:"王大明1")); zhangqi.add(new ItemName(name:"孫小明1")); List<ItemNameAddr> chaojiangeren = List<ItemNameAddr>(); chaojiangeren.add(new ItemNameAddr(name:"nnn1", addr:"aaa1")); chaojiangeren.add(new ItemNameAddr(name:"nnn2", addr:"aaa2")); class ItemName { String name; ItemName({ this.name }) ; ItemName.fromJson(Map<String, dynamic> json) : name = json['name']; Map toJson() => {"name": name }; //給json.