Skip to content

mark-lazarides/TwinCAT.JsonExtension

 
 

Repository files navigation

TwinCAT.JsonExtension

TwinCAT variables to and from json

Build status Codacy Badge codecov Licence Nuget Version

Bring the power of Json.Net to TwinCAT

Tranform DUTs decorated with the custom Json-Attribute like this:

TYPE JsonDUT :
STRUCT
	{attribute 'json' := 'message'}
	sMessage : STRING := 'test';
	iResponse : INT;
	{attribute 'json' := 'status'}
	sStatus : STRING := 'success';
	{attribute 'json' := 'numbers'}
	daNumbers : ARRAY[1..3] OF DINT := [1,2,3];
END_STRUCT
END_TYPE

into this (and back) recursively and absolutely type-independent:

{
  "message": "test",
  "status" : "success",
  "numbers" : [1,2,3]
}

only calling this two extension methods on your connected TcAdsClient:

var json = await client.ReadJson("GVL.JsonDutVariable")
await client.WriteJson("GVL.JsonDutVariable", json);

Have fun using this simple package and don't forget to star this project!

Referenced projects

Whould you like to see the power of TwinCAT.JsonExtension in action?

Then checkout BeckhoffHttpClient, an unofficial TwinCAT function for HTTP requests

or

TwincatAdsTool your swiss knife for twincat development.

Credits

Special thanks to JetBrains for supporting this open source project.

About

TwinCAT variables to and from json

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%