<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to JSON Utilities and SetArray</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/</id><updated>2024-05-11T14:49:38.736000Z</updated><subtitle>Recent posts to JSON Utilities and SetArray</subtitle><entry><title>JSON Utilities and SetArray</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/?limit=25#8edf/188a" rel="alternate"/><published>2024-05-11T14:49:38.736000Z</published><updated>2024-05-11T14:49:38.736000Z</updated><author><name>corriibme</name><uri>https://forge.codesys.com/u/corriibme/</uri></author><id>https://forge.codesys.com6175928d0b72ddabdeed23b285b947a66e52320a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello &lt;a class="user-mention" href="/u/florian/"&gt;@florian&lt;/a&gt;,&lt;br/&gt;
Could you please help with how to set an array value? I've been trying to use the with the setKeyWithArray method which creates the key with an empty array value. But I have been unable to set items in this array?&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;objindex&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;fb_JBuilder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SetKeyWithArray&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Key6"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;diParentIndex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;diRootIndex&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;objindex2&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;fb_JBuilder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SetValue&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;value&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;iValue2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;diParentIndex&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;objindexx&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;//iValue: array&lt;span&gt;[0..n]&lt;/span&gt; of int;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>JSON Utilities and SetArray</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/?limit=25#8edf" rel="alternate"/><published>2023-04-25T08:35:31.666000Z</published><updated>2023-04-25T08:35:31.666000Z</updated><author><name>florian</name><uri>https://forge.codesys.com/u/florian/</uri></author><id>https://forge.codesys.com647683d9d2777ba21338b5818d7e8fc2d95d918f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes that was the solution.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>JSON Utilities and SetArray</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/?limit=25#ddef" rel="alternate"/><published>2023-04-25T08:19:18.477000Z</published><updated>2023-04-25T08:19:18.477000Z</updated><author><name>i-campbell</name><uri>https://forge.codesys.com/u/i-campbell/</uri></author><id>https://forge.codesys.com257631d9984b9583a18623949d3a06ddf509d885</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;That looks like an array of one object.&lt;br/&gt;
maybe: SetArray();SetObject();SetKey();&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>JSON Utilities and SetArray</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/2a2b2acb17/?limit=25#abe2" rel="alternate"/><published>2023-04-25T08:00:43.227000Z</published><updated>2023-04-25T08:00:43.227000Z</updated><author><name>florian</name><uri>https://forge.codesys.com/u/florian/</uri></author><id>https://forge.codesys.come8dfd6126ab16ec31560c1cac36b831813902268</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
I'm using JSON Utilities SL and have to write a struct like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;"foo":"bar",&lt;/span&gt;
&lt;span class="err"&gt;"foobar":[&lt;/span&gt;
&lt;span class="err"&gt;    {"Key1":"val1", "Key2":"val2"}&lt;/span&gt;
&lt;span class="err"&gt;    ]&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Up to "foobar" it's straight forward.&lt;br/&gt;
Then I add SetArray(diIndex := 4, diParentIndex := 3);&lt;/p&gt;
&lt;p&gt;But when I want to add the next "Key1" with&lt;br/&gt;
SetKey(wsKey := "Key1", diParentIndex := 4, diIndex := 5);&lt;br/&gt;
I get an error "INVALID_KEY_PARENT".&lt;/p&gt;
&lt;p&gt;how can I set elements in the array?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>