Tag reference sheet

Tag library reference for the following tag libraries:

json

JSON (JavaScript Object Notation) rendering taglib

This is version 1.0.

  • array Creates a JSON array which consist of Strings, numeric values, booleans, JSON objects, or further JSON arrays
  • object Creates a JSON Object
  • property Represents a single property of a JSON object
Required attributes are marked with a *

<json:array>

Creates a JSON array which consist of Strings, numeric values, booleans, JSON objects, or further JSON arrays. You can pass a List of values using the 'items' attribute. This list will be iterated over, and each value in the list will be added to the JSON Array. If you specify a body for the tag, then the value of each element in the 'items' list will be set to the variabled as named by the 'var' attribute. The body will be rendered for every item in the list. You may also omit the 'items' collection, and add elements directly to the JSON array within the body of the tag. Each json:property, json:object and json:array encountered within the body of the tag will be added to the JSON array sequentially. Can contain: scriptless

Attributes

NameDescriptionType
escapeXmlShould special XML characters be escaped? (default:true)boolean
itemsA collection, array, or map of items that should be iterated overString
nameThe name of the array (required if nested within json:object tag)String
prettyPrintShould the rendered JSON be nicely formatted and indented? (default:false)boolean
trimShould whitespace be trimmed from the beginning and end of String values? (default:true)boolean
varThe name of a page variable that will be set to the item in the list as it is iterated overString

<json:object>

Creates a JSON Object. JSON Objects should in turn contain nested json:object, json:property and json:array tags to define the values contained therein. Objects can be nested as many times as you want.

Can contain: scriptless

Attributes

NameDescriptionType
escapeXmlShould special XML characters be escaped? (default:true)boolean
nameThe name of the object (required if nested within another json:object tag)String
prettyPrintShould the rendered JSON be nicely formatted and indented? (default:false)boolean

<json:property>

Represents a single property of a JSON object. This tag should be contained within a json:object or json:array tag. It will render a single name/value pair for the name and value specified. The value may be specified using either the value attribute, or it may be contained within the body of the tag. If using the body of the tag, then the content is assumed to be a String. If using the value attribute, the type can be any of String, Boolean, Integer, Long, Double or Object. Boolean types will be converted to a Javascript boolean value. Integer/Long/Double types will be converted to a Javascript numeric value. Strings and Objects will be converted to Javascript string values (using toString) All String data will have all whitespace trimmed from the beginning and end of the string before being set on the JSON Object. This behavior may be overridden by setting trim=false.

Can contain: scriptless

Attributes

NameDescriptionType
escapeXmlShould special XML characters be escaped? (default:true)boolean
nameThe name of the propertyString
trimShould whitespace be trimmed from the beginning and end of String values? (default:true)boolean
valueThe value of the property. If set this will override anything set in the body of the tag.String