[Gambas-user] JSON Encoder

T Lee Davidson t.lee.davidson at gmail.com
Thu Nov 19 23:17:15 CET 2020


On 11/19/20 3:51 PM, Martin wrote:
> *JSONEncode result.  t = JSON.Encode(ox) where ox is a JSONCollection
> *
> 
> /{"object":"BLOCK_CONTROL","index":0,"type":48,"handle":[0,1],"size":19,"bitsize":72,"ownerhandle":[4,0,0,0],"entries":[[2,1,44,44],[2,1,48,48]],"model_space":[3,1,2,2],"paper_space":[3,1,14,14]}/
> 
> As you see the "\n" is not present. I could try to replace coma "," by "\n," but structures like this [3, 1, 2, 2] will be 
> splited also that's not kool.
> 

JSON.Encode is only an encoder. It does not do formatting or pretty printing. If you need that, you could Shell out to `jq` or 
similar.


-- 
Lee


More information about the User mailing list