JSON array in Delphi -


i have place json string http request's body. 1 of string value must json array. how tried:

uses   dbxjson;  const   ccontent = 'hello world'; var   ljsonobject: tjsonobject;   x: tbytes;   i: integer;   temp: string; begin   ljsonobject:= tjsonobject.create;   ljsonobject.addpair('id1', 'value1');   ljsonobject.addpair('id2', 'value2');   ljsonobject.addpair('id2', 'value3');    x:= tencoding.ansi.getbytes(ccontent);   temp:= '';   := 0 length(x) - 1     temp:= temp + inttostr(x[i]) + ',';   delete(temp, length(temp), 1);    ljsonobject.addpair('id4', '[' + temp + ']');    showmessage(ljsonobject.tostring); end; 

this 1 not working, because value encapsulated in double quotes. proper way pass array value jsonobject?

you passing string rather array. hence result observe. rule, if find assembling json manually, doing wrong.

pass array:

var   arr: tjsonarray;   b: byte; .... arr := tjsonarray.create; b in tencoding.ansi.getbytes(ccontent)   arr.add(b); ljsonobject.addpair('id4', arr); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -