SendNuiMessage not acting as expected

Hello,

I’m currently writing some custom scripts in C# and I need to be interacting with the front end (JS) now. I’m trying to pass through a blob of JSON, however the code below and a few other variations including JSON arrays, escaping quotes and switching about are not working.

The expected parameter states “JSON string”.

SendNuiMessage("{‘test’: ‘testdata’}");

Sending an empty JSON string SendNuiMessage("{}"); works fine though.

Any help would be very appreciated!

Minisaints

I figured this out by finding a script written in c#.

You just need to pass a serialised JSON object using JsonConvert.