<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to How to sort JSON object in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740a043420/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740a043420/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/740a043420/</id><updated>2024-05-08T18:45:50.946000Z</updated><subtitle>Recent posts to How to sort JSON object in codesys</subtitle><entry><title>How to sort JSON object in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740a043420/?limit=25#117f" rel="alternate"/><published>2024-05-08T18:45:50.946000Z</published><updated>2024-05-08T18:45:50.946000Z</updated><author><name>yannickasselin</name><uri>https://forge.codesys.com/u/yannickasselin/</uri></author><id>https://forge.codesys.com6e8bd631194848b7e9ae9f31a89ee619289240b3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Just adding:&lt;br/&gt;
sSubscriberdata := '';&lt;br/&gt;
Right before your memcopy should fix the extra characters. It is because your are copying 36 characters into a string which can contain more than 36 characters and there is garbage left in the extra characters.&lt;/p&gt;
&lt;p&gt;Regarding the parsing of json, I usually build a structure that mirrors the jason data and use the available methods in the IIoT library to parse the data and fill the structure.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>How to sort JSON object in codesys</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/740a043420/?limit=25#4ddb" rel="alternate"/><published>2024-05-04T12:40:44.984000Z</published><updated>2024-05-04T12:40:44.984000Z</updated><author><name>garrian</name><uri>https://forge.codesys.com/u/garrian/</uri></author><id>https://forge.codesys.com780acdbf168fd2184d56e275f0cd0db52707108a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;I'm testing out MQTT from my Wago PLC using JSON object. I have managed to publish this {"Temperature":15.6,"Setpoint":38.0} to my broker. Now I', trying to subscribe to the same message. The result is this:&lt;br/&gt;
'{"Temperature":15.6,"Setpoint":38.0}95}ê$10&lt;code&gt;šå$04&lt;/code&gt;$Nå$08²Ÿå$0B` á$08@šå'&lt;/p&gt;
&lt;p&gt;First, why do I see 95}ê$10&lt;code&gt;šå$04&lt;/code&gt;$Nå$08²Ÿå$0B` á$08@šå' at the end of the message?&lt;/p&gt;
&lt;p&gt;Second, how Can i sort out this data to use it in my program? I followed a youtube tutorial which gave me the attached result, which works. But I need some other smart way of doing this when the object gets even more data in it.&lt;/p&gt;
&lt;p&gt;Any help is very appreciated :)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>