[
["Received", "by luna.mailgun.net with SMTP mgrt 8734663311733; Fri, 03 May 2013 18:26:27 +0000"],
["Content-Type", ["multipart/alternative", {"boundary": "eb663d73ae0a4d6c9153cc0aec8b7520"}]],
["Mime-Version", "1.0"], ["Subject", "Test bounces webhook"],
["From", "Bob <bob@rs19930.mailgun.org>"],
["To", "Alice <alice@example.com>"],
["Message-Id", "<20130503182626.18666.16540@rs19930.mailgun.org>"],
["List-Unsubscribe", "<mailto:u+na6tmy3ege4tgnldmyytqojqmfsdembyme3tmy3cha4wcndbgaydqyrgoi6wszdpovrhi5dinfzw63tfmv4gs43uomstimdhnvqws3bomnxw2jtuhusteqjgmq6tm@rs19930.mailgun.org>"],
["X-Mailgun-Sid", "WyIwNzI5MCIsICJhbGljZUBleGFtcGxlLmNvbSIsICI2Il0="],
["X-Mailgun-Variables", "{\"my_var_1\": \"Mailgun Variable #1\", \"my-var-2\": \"awesome\"}"],
["Date", "Fri, 03 May 2013 18:26:27 +0000"], ["Sender", "bob@rs19930.mailgun.org"]
]
我将此作为来自mailgun的邮件头。我需要将此标头解析为json。我尝试过JObject.Parse(message_headers)
和JArray.Parse(message_headers)
。但它不起作用。
当我删除["X-Mailgun-Variables", "{\"my_var_1\": \"Mailgun Variable #1\", \"my-var-2\": \"awesome\"}"]
时,它似乎有效。
请让我知道我做错了什么。
答案 0 :(得分:1)
问题是Mailgun标头不是JSON对象。我遇到了同样的问题,我解决它的方法是解析我需要的值并手动将它们转换为JSON对象。