custom json encode, which is able to encode arbitrary object: object will be encoded as map/dict, object's public attributes (the one does not starts with '_') will be its keys. Encoder will fail, if the object has circular reference as its public attribute