Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 1.03 KB

QueryJsonSelectTokenEscaped.md

File metadata and controls

31 lines (25 loc) · 1.03 KB

Querying JSON with JSON Path and escaped properties

This sample loads JSON with properties that need to be escaped when queried with Argon.JToken.SelectToken(System.String).

var o = JObject.Parse(
    """
    {
      'Space Invaders': 'Taito',
      'Doom ]|[': 'id',
      "Yar's Revenge": 'Atari',
      'Government "Intelligence"': 'Make-Believe'
    }
    """);

var spaceInvaders = (string) o.SelectToken("['Space Invaders']");
// Taito

var doom3 = (string) o.SelectToken("['Doom ]|[']");
// id

var yarsRevenge = (string) o.SelectToken("['Yar\\'s Revenge']");
// Atari

var governmentIntelligence = (string) o.SelectToken("['Government \"Intelligence\"']");
// Make-Believe

snippet source | anchor