Working with JSON

JavaScript Object Notation (JSON) is a language independent format for representing data structures. It is based on the JavaScript Programming Language and uses the same syntax as JavaScript uses for creating objects, strings, etc.

JavaScript Object Notation (JSON) is a language independent format for representing data structures. It is based on the JavaScript Programming Language and uses the same syntax as JavaScript uses for creating objects, strings, etc.

XDIME elements

The JSON elements, defined within the Client Framework 2, can be used in both an initial page, i.e. a page requested directly by the browser, and also in a response page, i.e. a page sent as an answer to an AJAX request. In each case there is a special element that provides page specific support, and a set of elements common to both.

Name Purpose
json:inline

Container for the JSON elements that allows them to be used within a Client Framework 2 page.

json:response

Container for the JSON elements in a response page, i.e. a page sent as an answer to an AJAX request. The element ensures that the response has the correct type of application/json.

The following elements are common to both cases. Each of these elements corresponds to the value with the same name and have the same type in JSON.

The following two elements are root elements that can be used inside the elements listed previously.

Name Purpose
json:array

Represents a JSON array structure.

json:object

Represents a JSON object structure.

The following elements can only be used within the body of the one of the elements specified previously.

Name Purpose
json:boolean

Represents a JSON boolean value.

json:null

Represents a JSON null value.

json:number

Represents a JSON number value.

json:property

Represents a JSON property.

json:string

Represents a JSON string value.

Parsing JSON expressions

The cf2:json.Parser component parses a JSON string into the equivalent JavaScript object.

Related topics