anchor.diff:  %% Function: parse_attr/1
   %% @end
   parse_attr(Query) ->
  +    %% Produces a list such as ["attr1", attr2[1], attr3]
       Attrs = re:split(Query, "\\.", [{return, list}]),
  -    lists:map(fun list_to_atom/1, Attrs).
  +    Fun = fun(X, Acc) ->
  +		  %% Produces a list such as ["attr1"] or ["attr2", "1]"]
  +		  case re:split(X, "\\[", [{return, list}]) of
  +		      [Attr] ->
  +			  %% The erlson library works on atoms
  +			  [list_to_atom(Attr)| Acc];
  +		      [Attr, IndexNoLeftBracket] ->
  +			  [Index, _] = re:split(IndexNoLeftBracket, "\\]", [{return, list}]),
  +			  %% The erlson library works on atoms and integers and the integers
  +			  %% cannot be 0, but the syntax specifies 0 as the first index,
  +			  %% so we add 1 to the index after conversion
  +			  [list_to_atom(Attr), (list_to_integer(Index)+1) | Acc] 
  +		  end
  +	  end,
  +    lists:foldr(Fun, [], Attrs).
   
   %% @doc
   %% @hidden
  
positive.code: -spec add_field(Json::json(),Field::field(),Value::json_value()) -> json_string().
  add_field(Json, Field, Value) ->
      add_field_internal(prepare_json(Json), Field, prepare_value(Value)).
  
  
  %% @doc 
  %% TODO Should be removed after add_field/1 has been improved.
  %% @end    
  -spec add_field2(Json::json(),Field::string(),Value::json_value()) -> json_string().
  add_field2(Json,Field,Value) when is_tuple(Json)->
      add_field2(to_string(Json), Field, Value);
  add_field2(Stream,Field,Value) when is_integer(Value) ->
      string:substr(Stream,1,length(Stream)-1) ++ ",\"" ++ Field ++ "\":" ++ Value ++ "}";
  add_field2(Stream,Field,Value) ->
      string:substr(Stream,1,length(Stream)-1) ++ ",\"" ++ Field ++ "\":" ++ Value ++ "}".
  
  %% @doc 
  %% TODO Should be improved to a general add_value(Json, Query, Value) function
  
negative.code: %% API functions - Exports
  %% ====================================================================
  -export([add_field/3,
  	 add_value_in_list/2,
  	 decode/1, 
  	 encode/1, 
  