org.xwiki.velocity.tools
Class JSONTool
java.lang.Object
org.xwiki.velocity.tools.JSONTool
public class JSONTool
- extends Object
Velocity tool to facilitate serialization of Java objects to the JSON format.
- Since:
- 4.0M2
- Version:
- $Id$
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSONTool
public JSONTool()
serialize
public String serialize(Object object)
- Serialize a Java object to the JSON format.
Examples:
- numbers and boolean values: 23, 13.5, true, false
- strings: "one\"two'three" (quotes included)
- arrays and collections: [1, 2, 3]
- maps: {"number": 23, "boolean": false, "string": "value"}
- beans: {"enabled": true, "name": "XWiki"} for a bean that has #isEnabled() and #getName() getters
- Parameters:
object - the object to be serialized to the JSON format
- Returns:
- the JSON-verified string representation of the given object
Copyright © 2004-2012 XWiki. All Rights Reserved.