Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure函数:如何从关键字中提取值?_C#_Json_Azure Functions - Fatal编程技术网

C# Azure函数:如何从关键字中提取值?

C# Azure函数:如何从关键字中提取值?,c#,json,azure-functions,C#,Json,Azure Functions,我有一个azure函数(webhook),它接收以下JSON [ { "email": "example@test.com", "event": "processed"} , { "email": "example@test.com", "event": "deferred"} , { "email": "example@test.com", "event": "open"} ] 我想解析JSON并将各个项添加到azure表中 当我尝试读取单个项的值时,我在item

我有一个azure函数(webhook),它接收以下JSON

[ 
    { "email": "example@test.com", "event": "processed"} , 
    { "email": "example@test.com", "event": "deferred"} ,
    { "email": "example@test.com", "event": "open"}
]
我想解析JSON并将各个项添加到azure表中

当我尝试读取单个项的值时,我在item.event上得到一个错误(我猜是因为event是一个关键字?)


有没有办法解决这个问题?

您可以在关键字前面使用
@
将其视为标识符:

eventType = item.@event
或者,我怀疑您可以使用索引器:

eventType = item["event"]

。。。但是你需要检查一下。

作为补充说明,我认为这根本不是特定于Azure的。在一个带有硬编码JSON的小型控制台应用程序中也会出现同样的错误。
eventType = item["event"]