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

Jesper Louis Andersen <>
Wed Oct 20 02:24:52 CEST 2010


On Tue, Oct 19, 2010 at 11:57 PM, Ryan Zezeski <> wrote:
> I feel like a lot of people tend to feel pain when working with JSON in
> Erlang.  Especially when trying to access nested values.  I wrote a blog
> post about a way you can access JSON in Erlang using the same syntax you
> would in JavaScript.

Have you considered wrapping the code into a parse transform so you
can "embed" the javascript notation into Erlang directly?

Another option is to write an xpath-like query tool, perhaps with a
Zipper construction on the parse tree so you have a neat continuation
for the next match, should you need it. This is probably my solution,
if I need to process JSON documents in the future. You already made
the first venture into this - think jQuery DOM selectors on steroids
for selection into JSON structures.


-- 
J.


More information about the erlang-questions mailing list