File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public override bool Execute()
6060 if ( string . IsNullOrEmpty ( content ) )
6161 return Log . Warn ( "JPE04" , $ "Empty JSON content.", true ) ;
6262
63- var json = JObject . Parse ( content ! ) ;
63+ var json = JToken . Parse ( content ! ) ;
6464
6565 Result = json . SelectTokens ( Query )
6666 // NOTE: we cannot create items with empty ItemSpec, so skip them entirely.
Original file line number Diff line number Diff line change 162162 <Error Condition =" '$(Port)' != '80'" Text =" Expected '80' but was $(Port)" />
163163 <Error Condition =" '$(Ssl)' != 'true'" Text =" Expected 'true' but was $(Ssl)" />
164164 </Target >
165+
166+ <Target Name =" PeekArray" >
167+ <PropertyGroup >
168+ <Json >
169+ [
170+ {
171+ "contributor": "jd",
172+ "favnumber": 10,
173+ "iscool": true
174+ },
175+ {
176+ "name": "impostor",
177+ "favnumber": 11,
178+ "iscool": false
179+ }
180+ ]
181+ </Json >
182+ </PropertyGroup >
183+
184+ <JsonPeek Content =" $(Json)" Query =" $[0]" >
185+ <Output TaskParameter =" Result" ItemName =" Array" />
186+ </JsonPeek >
187+ <PropertyGroup >
188+ <Contributor >@(Array -> '%(contributor)')</Contributor >
189+ <FavNumber >@(Array -> '%(favnumber)')</FavNumber >
190+ <IsCool >@(Array -> '%(iscool)')</IsCool >
191+ </PropertyGroup >
192+
193+ <Error Condition =" '$(Contributor)' != 'jd'" Text =" Expected 'jd' but was $(Contributor)" />
194+ <Error Condition =" '$(FavNumber)' != '10'" Text =" Expected '10' but was $(FavNumber)" />
195+ <Error Condition =" '$(IsCool)' != 'true'" Text =" Expected 'true' but was $(IsCool)" />
196+ </Target >
165197
166198</Project >
You can’t perform that action at this time.
0 commit comments