jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mic...@gmail.com>
Subject Encoding of JCR values in json
Date Thu, 12 Apr 2012 17:09:02 GMT


We need to come up with an encoding scheme for JCR values in JSON. While 
String and Boolean are straight forward double, long and decimal are 
already more troublesome. Finally for binary, date, name, path, 
reference, weakreference and uri there is no direct correspondence in JSON.

The way I solved this in spi2microkernel [1] is by encoding values by 
serializing them to their string representation (Value.getString()) and 
prepend its property type (value.getType) in radix 16 and a colon (:). 
So "A:123" would stand for a decimal value of 123. Boolean, long and 
some strings don't need the "x:" pre-amble since they can be 
unambiguously encoded to the respective JSON representation. Only String 
where the second character is a colon need the "x:" preamble for 

   "another long":"3:124",
   "another string":"1:a:string"

WDYT? Other suggestions?

On a related note: what kind of values do we want to expose from 
oak-core? JSON like or JCR like? Implementation wise, would that 
en/decoding happen inside oak-jcr or oak-core?



View raw message