0
我有一個數據集定義了2個與某個字段鏈接的temp-tables(讓我們說:item)。例如:使用動態密鑰創建JSON(Progress 4GL)
define temp-table items no-undo
field item as char.
define temp-table customer no-undo
field item as char serialize-hidden
field custname as char
field price as dec.
define dataset dsitemcust for items,customer
data-relation dr1 for items,customer relation-fields(item,item) nested.
這給JSON輸出是這樣的:
{
"items": [
{
"item": "abc_item",
"customer": [
{
"custname": "uvw_cust",
"price": 123
},
{
"custname": "xyz_cust",
"price": 234
},
....
]
},
{
"item": "def_item",
"custname": [{},{},...]
}
...
]
}
但我想是這樣的: [項目作爲重點和,CUSTNAME和價格 as value(在對象數組中custnum是關鍵再次)]
{ "abc_item" : [{"uvw_cust" : 123}, {"xyz_cust" : 234}, ...],
"def_item" : [{}, .. ],
..
}
這是可能的/可實現的進展openedge? (Progress版本:10.2B)
感謝您的回覆@TheDrooper。此代碼示例在Progress 11.x中運行良好,但不幸的是,在10.2B版本中不起作用。是否有任何解決方法使它在10.2B中工作? – Mahesh
它看起來像Progress 10.2B只支持你在例子中的表格到JSON。你可以嘗試構建你自己的JSON字符串函數,但這可能是很多工作。 – TheDrooper