Awesome, thanks.
-Greg
Clipboard
On Sep 19, 2011, at 12:53 PM, Jon Meredith wrote:
> I had a quick play with this. Mochijson2:encode returns an erlang I/O list.
> You can convert back to a proper binary with iolist_to_binary().
>
> precommit_json_identity(Obj) ->
> Values = riak_objec
I had a quick play with this. Mochijson2:encode returns an erlang I/O list.
You can convert back to a proper binary with iolist_to_binary().
precommit_json_identity(Obj) ->
Values = riak_object:get_values(Obj),
{struct, TermList} = mochijson2:decode(hd(Values)),
riak_object:apply_upda
On Sat, Sep 17, 2011 at 5:11 PM, Greg Pascale wrote:
> Hi,
> I'm trying to write a simple precommit hook to modify a JSON object by
> removing certain fields. The simplest way to do this, I figure, is to decode
> the object's value with mochijson2, remove the fields I don't want,
> re-encode it, a
Thanks,
I was able to work around the issue by using regexes to do string replacement,
thereby avoiding decoding and encoding JSON, but it would be nice to know what
was going wrong here.
-Greg
Clipboard
On Sep 19, 2011, at 11:44 AM, Sean Cribbs wrote:
> Greg,
>
> Your general approach loo
Greg,
Your general approach looks good, and jives with my reading of the
riak_object module. Let us know if you still have problems with mochijson2.
Sean
On Mon, Sep 19, 2011 at 1:42 PM, Greg Pascale wrote:
> Scratch that - the issue doesn't actually manifest without the
> decode/encode.
>
>
>
Scratch that - the issue doesn't actually manifest without the
decode/encode.
On Mon, Sep 19, 2011 at 10:47 AM, Greg Pascale wrote:
> Actually it looks like I can remove the JSON decode/encode and I still see
> the same issue. Just reading and writing the value is enough, so all I'm
> doing now
Actually it looks like I can remove the JSON decode/encode and I still see
the same issue. Just reading and writing the value is enough, so all I'm
doing now is
*precommit(RiakObject) ->*
*Value = riak_object:get_value(RiakObject),*
*riak_object:apply_updates(*
* riak_obje