One answer is: dict:to_list/1 and dict:from_list may be your friends.
Another is: Are you sure that dict is appropriate for your data? If the number 
of entries is bounded and does not exceed around a dozen, then a property list 
might be faster.
(Although I'd advice you to use lists:keyfind(Key, 1, PropList) rather than 
proplist:get_value(); there's a significant speed difference.)
Thirdly, you can of course translate to JSON and back, but keeping the data on 
Erlang term form is probably both simpler and faster.

/Erik

________________________________________
From: riak-users-boun...@lists.basho.com [riak-users-boun...@lists.basho.com] 
On Behalf Of Florian Odronitz [f...@twofloats.com]
Sent: 23 June 2012 16:39
To: riak-users@lists.basho.com
Subject: JSON-Encoding from riakc

Hello List,

I am using the riak-erlang-client and I am trying to store JSON. Now the 
riak_pb_kv_codec module assumes that when using the erlang client one would 
always like to encode data in erlang binaries. Which is ok with me _until_ 
riak_search needs to index this data.
I know the indexing also works on erlang data but only until one uses 
proplists. But I use dicts in all my data structures...
Any ideas about how to best proceed?

Thanks,
Florian
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to