A plugin for the Jackson streaming JSON processor v2.10.x that adds support for reading and writing JSON objects in the Rison serialization format. Support for Jackson:
Rison expresses the exact same data structures as JSON, but is much more compact and readable than JSON when encoded in a URI.
See https://github.com/Nanonid/rison for more information about Rison.
In your code, create a RisonFactory instead of a JsonFactory. Then read and write objects just
as you do regular JSON objects. All the Jackson mapper facilities are available with Rison.
importcom.bazaarvoice.jackson.rison.RisonFactory;
ObjectMapperRISON = newObjectMapper(newRisonFactory());
Stringstring = "(a:0,b:foo,c:'23skidoo')";
Mapmap = RISON.readValue(string, Map.class);
...
RISON.writeValueAsString(map);If you know the value you wish to serialize is always an object, you can configure the RisonFactory
to omit the containing ( and ) characters.
ObjectMapperO_RISON = newObjectMapper(newRisonFactory().
enable(RisonGenerator.Feature.O_RISON).
enable(RisonParser.Feature.O_RISON));
Stringstring = "a:0,b:foo,c:'23skidoo'";
Mapmap = O_RISON.readValue(string, Map.class);
...
System.out.println(O_RISON.writeValueAsString(map));If you know the value you wish to serialize is always an array, you can configure the RisonFactory
to omit the containing !( and ) characters.
ObjectMapperA_RISON = newObjectMapper(newRisonFactory().
enable(RisonGenerator.Feature.A_RISON).
enable(RisonParser.Feature.A_RISON));
Stringstring = "item1,item2,item3";
Listlist = A_RISON.readValue(string, List.class);
...
System.out.println(A_RISON.writeValueAsString(list));See the Rison page for implementations in JavaScript, Python and Ruby.