(no subject)
saradavis
wiki
(Thread)
Last updated: 2026-03-07
Home
saradavis
wiki
(WikiPage)
Project Members: saradavis (admin)
Last updated: 2026-03-07
wiki Discussion
osande
wiki
(Discussion)
Forum for wiki comments
Last updated: 2026-03-10
blog Discussion
osande
blog
(Discussion)
Forum for blog comments
Last updated: 2026-03-10
(no subject)
osande
wiki
(Thread)
Last updated: 2026-03-10
Home
osande
wiki
(WikiPage)
Project Members: osande (admin)
Last updated: 2026-03-10
Post by osande on Archive
CODESYS Forge
talk
(Post)
Problem with Visualization Manager and archiving. Project without VM has no problem. With VM in the project there is an error message and no archive has been created
Last updated: 2026-03-10
Post by osande on Archive
CODESYS Forge
talk
(Post)
V3.5 SP 21 Patch 5
Last updated: 2026-03-10
Archive
CODESYS Forge
talk
(Thread)
Archive
Last updated: 2026-03-10
wiki Discussion
ineffectua
wiki
(Discussion)
Forum for wiki comments
Last updated: 2026-03-10
blog Discussion
ineffectua
blog
(Discussion)
Forum for blog comments
Last updated: 2026-03-10
(no subject)
ineffectua
wiki
(Thread)
Last updated: 2026-03-10
blog Discussion
darwin03
blog
(Discussion)
Forum for blog comments
Last updated: 2026-03-10
Home
ineffectua
wiki
(WikiPage)
Project Members: ineffectua (admin)
Last updated: 2026-03-10
wiki Discussion
darwin03
wiki
(Discussion)
Forum for wiki comments
Last updated: 2026-03-10
(no subject)
darwin03
wiki
(Thread)
Last updated: 2026-03-10
Home
darwin03
wiki
(WikiPage)
Project Members: darwin03 (admin)
Last updated: 2026-03-10
Dynamically Update JSON Payload
CODESYS Forge
talk
(Thread)
Dynamically Update JSON Payload
Last updated: 2026-03-10
Post by fredashbolt on Dynamically Update JSON Payload
CODESYS Forge
talk
(Post)
I am trying to generate a JSON payload populated with a value that updates for use with a telemetry system, the payload is to be published by MQTT. I have established the MQTT client and can publish a working JSON payload but I can't get the payload to update as the value (iValue) changes. I am using a timer to trigger the .SetValue function periodically, but the JSON will only give the value as it is when it is first initialized using xFirst IF statement. Any suggestions? Thanks VAR pJsonData : POINTER TO JSON.JSONData := factory.Create(); fb_JBuilder : JSON.JSONBuilder; diRootIndex, diObject1Index : DINT; iValue : INT := 10 ; jsonArrayWriter : JSON.JSONByteArrayWriter; wsJsonData : WSTRING(1000); xFirst : BOOL := TRUE; utf8JsonData : STRING(2000); diTempVal : DINT ; PublishTimer : TON ; END_VAR IF xFirst = TRUE THEN fb_JBuilder ( pJsonData := pJsonData , diRootObj => diRootIndex ) ; diObject1Index := fb_Jbuilder.SetKeyWithObject ( "Device" , diParentIndex := diRootIndex ) ; diTempVal := fb_Jbuilder.SetKeyWithValue ( "Temp" , iValue , diParentIndex := diObject1Index ) ; xFirst := FALSE ; END_IF PublishTimer ( IN := PublishTimer.Q = 0 , PT := T#5S ) ; IF PublishTimer.Q THEN fb_JBuilder.SetValue ( iValue , diTempVal ) ; END_IF jsonArrayWriter( xExecute := PublishTimer.Q , pwData := ADR(wsJsonData), udiSize := SIZEOF(wsJsonData), jsonData := pJsonData^, xAsyncMode := FALSE ) ; JSON.Stu.ConvertUTF16toUTF8( ADR ( wsJsonData ) , ADR ( utf8JsonData ) , SIZEOF ( utf8JsonData ) , bStrictConversion := TRUE ) ;
Last updated: 2026-03-10
Home (version 1) discussion
ineffectua
wiki
(Thread)
Home (version 1) discussion
Last updated: 2026-03-10
wiki Discussion
fredashbolt
wiki
(Discussion)
Forum for wiki comments
Last updated: 2026-03-10
blog Discussion
fredashbolt
blog
(Discussion)
Forum for blog comments
Last updated: 2026-03-10
Home
fredashbolt
wiki
(WikiPage)
Project Members: fredashbolt (admin)
Last updated: 2026-03-10
(no subject)
fredashbolt
wiki
(Thread)
Last updated: 2026-03-10
Home (version 1) discussion
fredashbolt
wiki
(Thread)
Home (version 1) discussion
Last updated: 2026-03-10