This project has moved. For the latest updates, please go here.

Error on selectToken when Whitespace appears in property name in latest version

Jul 9, 2014 at 11:40 AM
I have just upgraded from version 5.0.1 to 6.0.3 and one of the things that has now started failing is when there is a space in the property name for eg

public class Product
    /// <summary>
    /// Gets or sets the expiry.
    /// </summary>
    public DateTime Expiry { get; set; }

    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Gets or sets the sizes.
    /// </summary>
    [JsonProperty(PropertyName = "Test Space")]
    public string[] Sizes { get; set; }
To prove this issue, i serialize the object to a json and parse it back into a JObject
string json = JsonConvert.SerializeObject(product);
        JObject jobj = JObject.Parse(json);
        var p = jobj.SelectToken("Test Space");

However with the latest version i get a parse error on the SelectToken statement. This works fine and expected and returns the whitespaced token with the version 5.0.1. Any ideas on whats changed?