WCF可以接受使用单引号和非引号标识符编码的JSON吗?

问题描述:

有没有一种方法可以指示WCF接受使用单引号(而不是双引号)格式化的JSON:

Is there a way that I can instruct WCF to accept JSON that is formatted using either single quotes (as opposed to double quotes):

{
   'foo': 'bar'
}

或使用非引用标识符,例如:

Or using non-quoted identifiers like so:

{
    foo: 'bar'
}

照原样,似乎JSON仅在格式如下时才会被接受:

As it is, it seems like JSON will only be accepted if it is formatted like so:

{
    "foo": "bar"
}

使用前两个示例中的任何一个都会产生400(错误的请求).

Using either of the first two example results in a 400 (bad request).

前两个示例是无效的JSON文本. http://www.ietf.org/rfc/rfc4627.txt

The first two examples are invalid JSON texts. http://www.ietf.org/rfc/rfc4627.txt

object = begin-object [ member *( value-separator member ) ]
end-object

member = string name-separator value

string = quotation-mark *char quotation-mark

quotation-mark = %x22      ; "