forked from JamesNK/Newtonsoft.Json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectToken.aml
53 lines (50 loc) · 2.61 KB
/
SelectToken.aml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?xml version="1.0" encoding="utf-8"?>
<topic id="SelectToken" revisionNumber="1">
<developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
<introduction>
<para>
<codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.SelectToken</codeEntityReference>
provides a method to query LINQ to JSON using a single string path to a desired
<codeEntityReference>T:Newtonsoft.Json.Linq.JToken</codeEntityReference>.
SelectToken makes dynamic queries easy because the entire query is defined in a string.</para>
<autoOutline lead="none" excludeRelatedTopics="true" />
</introduction>
<section address="SelectToken">
<title>SelectToken</title>
<content>
<!-- Uncomment this to create a sub-section outline
<autoOutline /> -->
<para>SelectToken is a method on JToken and takes a string path to a child token.
SelectToken returns the child token or a null reference if a token couldn't be
found at the path's location.</para>
<para>The path is made up of property names and array indexes separated by periods,
e.g. <codeInline>Manufacturers[0].Name</codeInline>.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="SelectTokenComplex" title="SelectToken Example" />
</content>
</section>
<section address="SelectTokenJSONPath">
<title>SelectToken with JSONPath</title>
<content>
<para>SelectToken supports JSONPath queries. Find out more about JSONPath <externalLink>
<linkText>here</linkText>
<linkUri>https://goessner.net/articles/JsonPath/</linkUri>
<linkTarget>_blank</linkTarget>
</externalLink>.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\Samples\JsonPath\QueryJsonSelectTokenJsonPath.cs" region="Usage" title="SelectToken With JSONPath" />
</content>
</section>
<section address="SelectTokenLINQ">
<title>SelectToken with LINQ</title>
<content>
<!-- Uncomment this to create a sub-section outline
<autoOutline /> -->
<para>SelectToken can be used in combination with standard LINQ methods.</para>
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\LinqToJsonTests.cs" region="SelectTokenLinq" title="SelectToken With LINQ Example" />
</content>
</section>
<relatedTopics>
<link xlink:href="LINQtoJSON" />
<codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.SelectToken</codeEntityReference>
</relatedTopics>
</developerConceptualDocument>
</topic>