Skip to main content


Parses JSON data into objects




Name Type Description
JSONstring String A valid JSON string


Almost anything (see ‘Description’, below)


This method parses JSON (JavaScript Object Notation) data, as specified in the RFC4627 specification, as described in a more informal way at and as widely used by web services on the Internet.

Depending on the specific JSON data received, this function can return almost any Squirrel data type: table, array, string, float, integer, bool or null. However, it cannot return or invoke Squirrel functions, and thus is ‘safe’ to use with untrusted data from the Internet.

Tables and arrays can be nested up to five levels deep.

A Squirrel error is produced if the JSON is not valid. This error can be detected using Squirrel’s normal try ... catch mechanism.

The corresponding encoding operation is http.jsonencode().

Example Code