1

This is part of a larger problem I am working on. However, I have attempted to break it down to the simplest form possible.

I am using JSON.Net, and trying to deserialize several JSON objects into KeyValuePair, but I cannot get even a simple example test to work.

var pair = JsonConvert.DeserializeObject<KeyValuePair<string, string>>(@"""the key"": ""the value""");

This throws a JsonReaderException -- After parsing a value an unexpected character was encountered: :. Line 1, position 10.

It seems to choke on the colon character, which I find rather odd. I've used JSON.Net several times before, and never have run into anything like this.

1 Answer 1

3

Okay, got this figured out. Has to be in the following form to deserialize properly:

{"Key":"the key","Value":"the value"}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.