json_encode - serializes an LPC value as JSON SYNOPSIS string json_encode(mixed value) DESCRIPTION Returns a string attempting to represent the passed value in JSON (JavaScript Object Notation; see http://json.org/). The data types which map well from LPC to JSON are single-value mappings with string keys (which are represented as objects), arrays, strings, ints, and floats. Many LPC values, including objects, closures, quoted arrays, and symbols, have no valid JSON representation. json_encode() uses "null" for these. Non-string mapping keys also have no valid JSON representation; these are skipped. json_encode() represents zero-width mappings as JSON arrays and multivalue mappings as if the value sets were arrays of values. These representations are inexact and do not result in restoration of the original value via json_decode(). If json_encode() encounters a self-referential data structure, it will use "null" for inner references to the structure (instead of recursing infinitely). EXAMPLES json_encode(([ "name" : "Bob" ])) => "{\"name\":\"Bob\"}" json_encode(({ 1, 2, 0.5 })) => "[1,2,0.5]" mixed * selfref = ({ 1, 2, 3, 0 }); selfref[3] = selfref; json_encode(selfref) => "[1,2,3,null]" SEE ALSO json_decode(sefun), save_value(efun), restore_value(efun)