JSON (library)

Categories:Objects

Overview

Summary

JSON functionality for JSFL

Contents

API

JSON.encode(obj)

Encodes an Object as a JSON String,Non-integer/string keys are skipped in the object, as are keys that point to a function.,

Parameters:

  • obj Object The json-serializble *thing* to be converted

Returns:

  •   String A JSON String

The following example :

var json = JSON.encode([1, 2, 3, {a:1, b:'Hello'}]);
trace(json);
[1,2,3,{"a":1,"b":"Hello"}]

JSON.decode(src)

Evaluates a given piece of json source.

var value = JSON.decode('[1,2,3,{"a":1,"b":"Hello"}]')
Output.inspect(value);
Inspect: Array (depth:4, objects:1, values:5, time:0.0 seconds)
--------------------------------------------------------------------------------
array => Array
	 0: 1
	 1: 2
	 2: 3
	[3] => Object
		 a: 1
		 b: "Hello"

 

Comments are closed.