JSON-Encoding from riakc

Erik Søe Sørensen ess at trifork.com
Sun Jun 24 06:11:31 EDT 2012

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.


From: riak-users-bounces at lists.basho.com [riak-users-bounces at lists.basho.com] On Behalf Of Florian Odronitz [fo at twofloats.com]
Sent: 23 June 2012 16:39
To: riak-users at 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?

riak-users mailing list
riak-users at lists.basho.com

More information about the riak-users mailing list