gpt4 book ai didi

azure - 在 Azure Devops 发布管道上的 Appsettings.Json 中添加数组元素 通过 magic chunks 配置转换

转载 作者:行者123 更新时间:2023-12-03 03:52:14 25 4
gpt4 key购买 nike

我正在 azure devops 发布管道上使用 magic chunks 配置转换,我尝试在 appsettings.jason 中添加数组元素,但我找不到任何实际示例,我使用以下代码创建了数组 ->

 "my_array[]`0', 

但它给出了这样的结果:

{
"my_array" :
[
"value" : 1,
]
}

它无法在其中添加对象元素,我想在appsetting中创建以下json:

{
"my_array" :
[
{"value" : 1},
{"value" : 5}
]
}

我发现以下代码必须有效,但它不起作用:

   my_array[]`0/@value

enter image description here

最佳答案

您似乎已经安装了这个第3方扩展:Magic Chunks在组织中。在我这边测试后,我得到以下结果。下面是appsetting.json。

{
"my_array" :
[
{"value" : 1},
{"value" : 5}
]
}

然后我可以用以下转换替换其元素。

{
"my_array[1]/value" : 3
}

enter image description here然后结果如下。

{
"my_array": [
{
"value": 1
},
{
"value": "3"
}
]
}

但是,如果我尝试使用以下转换添加元素,它总是会失败。

{
"my_array[2]/value" : 5
}

{
"my_array[0]/value" : 1,
"my_array[1]/value" : 3,
"my_array[2]/value" : 5
}

等等。似乎不支持添加新元素。同时,我看到您在这里提交了此反馈:https://github.com/magic-chunks/magic-chunks-dotnetcore/issues/131 ,我会持续关注并希望得到作者的反馈。

关于azure - 在 Azure Devops 发布管道上的 Appsettings.Json 中添加数组元素 通过 magic chunks 配置转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66255736/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com