We have code in https://github.com/picketbox/picketbox/tree/master/json that Anil Saldhana has written that needs to be ported over to PicketLink.