mono_v2_get_started icon indicating copy to clipboard operation
mono_v2_get_started copied to clipboard

'Native' JSON support

Open BlackFlash5 opened this issue 2 years ago • 6 comments

Goal

If you want to work with JSON you'd have to ship an 'old' portable build of e.g. Json.NET (aka Newtonsoft.Json) with your resource. Only portable builds are supported by FiveM (at least in v1), but building as portable-net45 is deprecated and many libs dropped support. The goal would be to have a JSON implementation like Json.NET or System.Text.Json in v2 without providing 3rd party libs with your resource.

Importancy

Overal quality to the runtime

API and/or potential implementation

System.Text.Json is getting shipped with the runtime since .NET Core 3.0, but is also compatible with older versions and .NET Framework. Would it be possible to ship System.Text.Json with v2?

Extra

No response

BlackFlash5 avatar Jun 20 '23 23:06 BlackFlash5

I've been thinking about something like this. I'll have a look into this NuGet package, thanks!

thorium-cfx avatar Jun 21 '23 08:06 thorium-cfx

I'd keep using the 3rd party library Newtonsoft.Json even if System.Text.Json was integrated, there's a reason it has 3.3 billion downloads on NuGet. The best thing in my opinion would be to support .NET 6.0 or .NET 7.0 in FiveM but it's just a dream :(

Sasino97 avatar Jun 27 '23 03:06 Sasino97

there's a reason it has 3.3 billion downloads on NuGet

One would be that System.Text.Json was introduced by Microsoft in 2019, while Json.NET released in 2006, but anyone has their preference anyways and discussions like that are pretty pointless (like "iOS or Android")...

BlackFlash5 avatar Jun 27 '23 20:06 BlackFlash5

This issue is marked as stale because it has been open for 30 days without any activity.

github-actions[bot] avatar Jul 28 '23 02:07 github-actions[bot]

System.Text.Json has serious improvements in the allocation department and notably a much larger range of support, bonus points that it has source-gen options

net6 and up support would be pretty big for Client & Server resources

Twinki14 avatar Dec 27 '23 04:12 Twinki14

Doubt we'll see movement to newer versions of .NET for a while due to the sandboxing within FiveM. There have been a lot of discussions on it, all of them shut down.

Local9 avatar Jan 18 '24 23:01 Local9