Garry's Mod Wiki

util.JSONToTable

  table util.JSONToTable( string json, boolean ignoreLimits = false, boolean ignoreConversions = false )

Description

Converts a JSON string to a Lua table.

See util.TableToJSON for the opposite function.

This will attempt to cast the string keys "inf", "nan", "true", and "false" to their respective Lua values. This completely ignores nulls in arrays.

Issue Tracker: 3561
Colors will not have the color metatable.

Issue Tracker: 2407

Arguments

1 string json
The JSON string to convert.
2 boolean ignoreLimits = false
ignore the depth and breadth limits, use at your own risk!.
If this is false, there is a limit of 15,000 keys total.
3 boolean ignoreConversions = false
ignore string to number conversions for table keys.
if this is false, keys are converted to numbers wherever possible. This means using Player:SteamID64 as keys won't work.

Returns

1 table
The table containing converted information. Returns nothing on failure.