Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public int GetValuesUsingValueMethod()
var name = jsonObject.Value<string>("name");
var make = jsonObject.Value<string>("make");
var model = jsonObject.Value<string>("model");
var year = jsonObject.Value<string>("year");
var year = jsonObject.Value<int>("year");

var amount = jsonObject.Value<JObject>("price")
.Value<int>("amount");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// See https://aka.ms/new-console-template for more information
using GetValueByKeyFromJObject;

Console.WriteLine("Application Started");
var jObjectManipulation = new JObjectManipulation();

jObjectManipulation.GetValuesUsingIndex();
jObjectManipulation.GetValuesUsingValueMethod();
jObjectManipulation.GetValuesUsingSelectToken();
jObjectManipulation.GetValuesUsingTryGetValue();
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class TestData
{
public string GenerateSingleJsonObject()
{
const string car = $$"""
const string car = """
{
"name": "Charger",
"make": "Dodge",
Expand Down
10 changes: 5 additions & 5 deletions json-csharp/GetValueByKeyFromJObject/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.10.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="10.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading