For the complete documentation index, see llms.txt. This page is also available as Markdown.

JSONDeserialize

Converts a JSON (JavaScript Object Notation) string data representation into data, such as a structure or array.

JSON deserialization in BoxLang will always use ordered structs for objects which will preserve the key order of the original JSON string. This is handy when reading a JSON file, modifying it, and writing it back out.

Method Signature

JSONDeserialize(json=[string], strictMapping=[boolean], useCustomSerializer=[string])

Arguments

Argument
Type
Required
Description
Default

json

string

true

The JSON string to convert to data.

strictMapping

boolean

false

A Boolean value that specifies whether to convert the JSON strictly. If true, everything becomes structures.

true

useCustomSerializer

string

false

A string that specifies the name of a custom serializer to use. (Not used)

Examples

Deserialize a JSON string

json = '{"name":"Luis","age":42}';
result = jsonDeserialize( json );
writeOutput( result.name );

Result: Luis

Deserialize a JSON array

Result: 3

Last updated

Was this helpful?