See: Description
Interface | Description |
---|---|
MarshallerInterface |
interface for a marshaller. shouldn't be used directly
|
ObjectConverterInterface |
Used to convert a simple object.
|
SerieConverterInterface |
SerieConverterInterface should be used by class that would render as js array.
|
UnmarshallerInterface |
Interface fo unmarshaller, shouldn't be used directly
|
Class | Description |
---|---|
BeanParser |
BeanParser is used to convert a js object into a bean.
|
JSONContext |
JSONContext is the main class you use to convert java into and from js code.
|
Marshaller |
marshaller convert java object into js code/object you don't create the class directly but acces it throw JSONContext
|
Unmarshaller |
unmarshaller convert js object source code into java object
you don't create the class directly but acces it throw JSONContext.
|
Exception | Description |
---|---|
NotYetDefinedException | |
ParserException |
base exeption for any expetion throw by others VostokJsonLib object
|
SourceFormatException |
throw when detect an error on json source data (type open {, ", etc..)
|
The main class is JSONContext.
Convert json source into some java object :
Convert some java object :Unmarshaller bp = JSONContext.getInstance().getUnmarshaller(); String str = (String) bp.unmarshal(String.class, "my json string"); Integer val = (Integer) bp.unmarshal(Integer.class, "666"); int[] vali = (int[]) bp.unmarshal(int[].class, "[1,2,3,4]"); String data = "[{val:\"first\"},{val:\"second\"},{val:\"third\"}]"; SimpleBean[] array = (SimpleBean[]) bp.unmarshal(SimpleBean[].class, data);
Marshaller bp = JSONContext.getInstance().getMarshaller(); Double d = Math.PI; String answer = bp.marshal(d); SimpleBean bean = new SimpleBean(); // init bean values ... String answer = bp.marshal(bean)
JSONContext