in Microsoft.Shared.Dna.Json/JsonParser.cs [513:551]
public bool TryParseToken(out string value)
{
value = null;
if (this.TokenType.IsNull())
{
return true;
}
int trim = 0;
if (this.TokenType == JsonTokenType.String)
{
trim = 2;
}
else if (this.TokenType == JsonTokenType.BeginProperty)
{
int cursor = this.TokenSegment.Offset + this.TokenSegment.Count - 2;
trim = cursor - this.EatWhitespaceReverse(cursor) + 3;
}
if (trim > 0)
{
StringSegment subsegment = new StringSegment(this.TokenSegment.String, this.TokenSegment.Offset + 1, this.TokenSegment.Count - trim);
/* Skip the enclosing quotation marks. */
if (!this.decode)
{
/* If there are no character escapes, then skip the more complicated decoding logic. */
value = subsegment.ToString();
return true;
}
return this.TryParseTokenUnsafe(subsegment, out value);
}
else
{
value = this.TokenSegment.ToString();
}
return true;
}