[erlang-questions] Access JSON in Erlang like you do in JavaScript

Ryan Zezeski <>
Thu Oct 21 07:38:31 CEST 2010


On Wed, Oct 20, 2010 at 1:22 AM, Richard O'Keefe <> wrote:

>
> On 20/10/2010, at 10:57 AM, Ryan Zezeski wrote:
>
> One example in the link would be
>
>        at(Obj, <<"post">>, <<"title">>)
>
> Another would be just
>
>        at(Obj2, <<"person">>, <<"friends">>, 1)
>
> Adjusting this to the data structure used by mochijson2 would be simple
> too.
> It hardly seems worth adding special syntax and transformations to Erlang
> for something this simple.
>
> So what am I missing?
>

 I don't think you're missing anything.  I think you and Robert both make
great points.  Although, there is a part of me that still likes the fact
that I can use JavaScript syntax with my solution.

I agree that using parse transformations for this is probably not the best
idea, but in the case of using Neotoma I'm only using parse transformations
during the parsing of the PEG.  The output is just another Erlang module.
 Of course, I'm assuming you already know this and you were referring to the
other ideas on the table.  Just wanted to clarify for anyone else reading
this.

Maybe there is room for multiple solutions.  You know...different strokes
for different folks.  I wanted to share my finding as I hadn't seen anything
like it before.

Thanks for the input, everyone.


More information about the erlang-questions mailing list