Do we have support to Json.net?
See original GitHub issueThat sounds dumb, but I have the models from my Backend different than my Frontend, so I have a middle layer to treat things like this. I want to implement typewriter, but does it support Json.net? I have the Model in C# like:
` public class myModel
{
[JsonProperty(PropertyName = "id")]
public int id { get; set; }
[JsonProperty(PropertyName = "description")]
public string description { get; set;
}
[JsonProperty(PropertyName = "startDate")]
public string start_date { get; set; }
[JsonProperty(PropertyName = "endDate")]
public string end_date { get; set; }
[JsonProperty(PropertyName = "val")]
public float p_value { get; set; }
}`
And I want the result inside the Typescript as:
export class myModel{
// ID
public id: number = 0;
// DESCRIPTION
public description: string = null;
// STARTDATE
public startDate: string = null;
// ENDDATE
public endDate: string = null;
// VAL
public val: number = 0;
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Json.NET - Newtonsoft
If you need it, Json.NET supports converting between XML and JSON. Open Source. Json.NET is open source software and is completely free for...
Read more >Migrate from Newtonsoft.Json to System.Text.Json - .NET
Learn about the differences between Newtonsoft.Json and System.Text.Json and how to migrate to System.Text.Json.
Read more >Newtonsoft.Json vs System.Text.Json vs Json.Net : r/csharp
Json will handle it better. Upvote 11
Read more >Does .NET 4 have a built-in JSON serializer/deserializer?
JSON.Net is well supported and it appears that Microsoft intend to adopt it themselves "We on the web team will be including JSON.NET...
Read more >Despite .NET Core 3 Deprecation, Newtonsoft JSON ...
Despite being deprecated by Microsoft in .NET Core 3.0, the wildly popular Newtonsoft.Json JSON serializer still rules the roost in the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I’m using the properties as start_date, because the backEnd uses like that, but the frontEnd is in camelCase.
Thank you, I’m going to read the documentation
Is there a reason you are naming the properties start_date and not StartDate?
You could then just use: Json.NET’s CamelCasePropertyNamesContractResolver and remove the json property declarations: https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Serialization_CamelCasePropertyNamesContractResolver.htm