C# using Newtonsoft.JSON client side

Anyone knows how to use JSON client side?

Not sure what im doing wrong, I added the portable version of Newtonsoft Json to the client csproj, aswell as trying to add the dll to the files in fxmanifest, still get this error: https://i.imgur.com/9lIjTYl.png

CSPROJ: https://i.imgur.com/haVDFwT.png

Any ideas?

I believe you have to load the newtonsoft json dll as a client script or a file in the fxmanifest

Could be wrong as I honestly don’t use C# much but pretty sure you have to load dlls into the client using the fxmanifest.

Hi @xander1998. I have also tried to do this. Both as a client_script and as a file. Didn’t change anything sadly. It might be that I’m referencing the wrong DLL, I only added the Newtonsoft.Json.dll from the client directory, I haven’t tried adding the server Netwonsoft.Json.dll. Anyways, if you happen to have any other ideas, please do so. I am a bit lost at this point.

My fxmanifest looks like this: https://i.imgur.com/P4ZsJOx.png

Try moving the newtonsoft json dll into the root of your resource folder.

Hi, I managed to figure out the problem. When using the FiveM C# template it uses dotnet publish. And when using publish, it wouldn’t be the correct Newtonsoft.Json file. I redid the build.cmd to use build instead of publish and it now gets the correct file.

Thanks for the help anyways :slight_smile:

Awesome glad you figured it out.

1 Like