BBJSP JSON:Object Tag (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 17.0 and higher, the object tag can be used within a BBJSP Page to create a JSON Object. If the object is being placed within another object then you must specify the name attribute.

Attributes

Attribute Name

Description

Required

Expression

Data Type

name

If this <JSON.Object> is stored within a JSON Object then the name attribute is used for the identifier within theJSON Object.

false

true

String

pretty

the pretty attribute is used to specify that the generated output from this <JSON.Object> should be nicely formatted and indented.

true

true

Object

Remarks

The JSON Tag Library needs to be referenced in the BBJSP Page

Example

<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<%@ taglib uri='/WEB-CFG/tld/json.tld' prefix='json' %>
<% 
num = 123.45
num2 = 999.99 
%>
<c:set var='X' value='123.45'/>
<c:set var='Y' value='987.654'/>
<json:vector>
<json:object>
<json:string name='str' value='Wibble' />
<json:integer name='int' value='<%= num %>' />
<json:float name='float' value='${X}' />
<json:boolean name='bool' value='false' />
<json:object name='wibble'>
<json:string name='str' value='A String' />
<json:boolean name='bool2' value='false' />
</json:object>
</json:object>
<json:string name='str' value='XXXXXXXXX' />
<json:boolean name='bool' value='0' />
<json:integer name='int' value='${Y}' />
<json:float name='float' value='${Y}' />
<json:float name='float' value='${X * Y}' />
</json:vector>

See Also

BBJSP

JSON Tag Library