HolyLib Wiki

util.FancyTableToJSON

 string util.FancyTableToJSON( table tbl, boolean pretty, boolean ignorecycle = false )

Description

It's util.TableToJSON but faster and it will turn numbers into integers if they fit as one.

This implementation will include null for values it cannot handle.
Gmod hides null but we don't meaning if for example we get {math.huge} as input, it will return [null] which still is valid json.

Arguments

1table tbl

The table to turn into json

2boolean pretty

Make it a pretty json string

3boolean ignorecycle = false

If true it won't throw a lua error when you have a table that is recursive/cycle.

Returns

1string json

The final json string