Sounds good, how is it with the other way around?
Say, I have a 2dim longint array and would like to stringify it to json.

Pseudo code ( I don't know (yet) the API of the NTK plugin):

------------------------
ARRAY LONGINT($values;1;1)
$values{1}{1}:=4711

JSON Set Array($object;”values”;$values)
$resultText:=JSON to Text($object)
------------------------

The result should be:
{ "values": [
    [ 4711 ]
] }

Is this possible too?

Thanks in advance
Lutz Epperlein


> -----Original Message-----
> From: 4D_Tech [mailto:[email protected]] On Behalf Of Rob Laveaux
> via 4D_Tech
> Sent: Thursday, July 27, 2017 2:35 PM
> To: 4D iNug Technical <[email protected]>
> Cc: Rob Laveaux <[email protected]>
> Subject: Re: 2dim json arrays with scalar values
> 
> 
> > On 27 Jul 2017, at 14:09, Epperlein, Lutz (agendo) via 4D_Tech
> <[email protected]> wrote:
> >
> > Is there any way to get the wanted result?
> 
> 
> Hi Lutz,
> 
> Yes, there is. Use the JSON commands from NTK Plugin.
> 
> Here is some example code:
> 
> $object:=JSON Parse Text($json)
> If ($object#0)
>       $array1:=JSON Get Array($object;”values”)
>       $count1:=JSON Count Items($array1)
>       For($i;1;$count1)
>               $array2:=JSON Get Array($array1;String($i))
>               $count2:=JSON Count Items($array2)
>               For($j;1;$count2)
>                       $value:=JSON Get Number($array2;String($j))
>               End for
>       End for
>       JSON Release($object)
> End if
> 
> HTH,
> 
> - Rob Laveaux
> 
> --------------------------------------------------------
> Pluggers Software
> Scholekstersingel 48
> 2496 MP  Den Haag
> The Netherlands
> 
> Email: [email protected] <mailto:[email protected]>
> Website: http://www.pluggers.nl <http://www.pluggers.nl/>
> 
> --------------------------------------------------------
> 
> 
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to