anchor.diff:      {[Name, Value], HProps} = lists:split(2, HProps0),
       hprops_to_props(HProps, [{Name, jiffy:decode(Value)} | R]).
   
  -read_json(Req, #state{hash = Hash} = State) ->
  +read_json(Req, #state{mode = pointer, hash = Hash} = State) ->
       Q = <<"select hstore_to_array(value) from objects where hash=$1">>,
       case cloudstore_pg:equery(cloudstore_pool, Q, [Hash]) of
           {ok, _, []} -> {halt, Req, State};
           {ok, _, [{HProps}]} ->
               {jiffy:encode({hprops_to_props(HProps)}), Req, State}
  -    end.
  +    end;
  +read_json(Req, #state{mode = expr} = State) ->
  +    {jiffy:encode([]), Req, State}.
   
   props_to_hprops(Props) ->
       lists:append([[Name, jiffy:encode(Value)] || {Name, Value} <- Props]).
  
positive.code: segments_to_hprops(Segments) ->
      lists:append(lists:foldl(fun(Value, R) -> [[list_to_binary(integer_to_list(length(R))), Value] | R] end, [], Segments)).
  
  write_json(Req, #state{hash = undefined, path = Path, segments = Segments} = State) ->
      {ok, Json, Req0} = cowboy_req:body(Req),
      {Props} = jiffy:decode(Json),
      Q = <<"insert into objects(hash,version,path,value) values (md5($1),0,hstore($2::text[]),hstore($3::text[]))">>,
      {ok, _} = cloudstore_pg:equery(cloudstore_pool, Q, [Path, segments_to_hprops(Segments), props_to_hprops(Props)]),
      {true, Req0, State};
  
  write_json(Req, #state{hash = Hash} = State) ->
      {ok, Json, Req0} = cowboy_req:body(Req),
      {Props} = jiffy:decode(Json),
      HProps = lists:append([[Name, jiffy:encode(Value)] || {Name, Value} <- Props]),
  
negative.code: -export([write_json/2]).
  -export([delete_resource/2]).
  
  -record(state, {path, segments, hash, mode}).
  
  init(_Transport, _Req, _Opts) ->
      {upgrade, protocol, cowboy_rest}.
  