Lasso Soft Inc. > Home

[ json_deserialize ]

Method

[json_deserialize] takes a bytes or string object in JSON format and returns a map of all name/value pairs. Nested JavaScript arrays are returned as Lasso map objects.

  • Syntax
json_deserialize(bytes)

json_deserialize(string)
Examples
  • Beginner

Serialize a Lasso map variable and deserialize

Use [json_serialize] and [json_deserialize] to perform these functions.

Code

local(in = json_serialize(map('a' = 1, 'b' = array(1,2,3,4))))
'JSON formatted: '+#in
'\r'
'JSON deserialized: '+ json_deserialize(#in)
Resources
  • Articles

Recent Comments

"...and returns a map of all name/value pairs. Nested JavaScript arrays are returned as Lasso map objects."

True when the JSON object is a map, but returns an array if the JSON object is an array. Nested JavaScript arrays are returned as Lasso array objects.

example:

var(json = json_serialize(array(array('a','b'),2,3)))

yields:

array(array(a, b), 2, 3)

As expected.

Posted on: 29 January 2014

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft