[erlang-questions] mochijson2 decode

richard claxton rich.claxton@REDACTED
Tue Jun 7 15:36:09 CEST 2011


Ok Cheers for the feed back.

Rich

On Tue, Jun 7, 2011 at 2:34 PM, Bob Ippolito <bob@REDACTED> wrote:

> In a string you need to escape the quotes so that the parser can know
> when the string ends. This is required in essentially any programming
> language. In some languages you may be able to use a different quote
> character for your string, but in Erlang there is only one so
> embedding strings with lots of quotes does look noisy. In practice
> this isn't a problem because most of your JSON is going to be coming
> from the network or disk and not embedded in Erlang source strings.
>
> On Tue, Jun 7, 2011 at 6:06 AM, richard claxton <rich.claxton@REDACTED>
> wrote:
> > I though i should be able to run this.
> > mochijson2:decode( "{ "colour" : "red", "value" : "#f00" }" ).
> > but get  2: syntax error before: colour
> > Like you said i think its the syntax, but i cant see it.
> > Cheers Richard
> >
> > On Tue, Jun 7, 2011 at 1:51 PM, Bob Ippolito <bob@REDACTED> wrote:
> >>
> >> It sounds like your input isn't JSON, or maybe you've misunderstood
> >> something about Erlang syntax. If you post some code it may help
> >> pinpoint exactly what's going on.
> >>
> >> On Tue, Jun 7, 2011 at 5:22 AM, richard claxton <rich.claxton@REDACTED
> >
> >> wrote:
> >> > I am new to erlang and i am playing around with mochijson2, JSON
> parsing
> >> > from a http post, I can decode the json http request if i escape all
> the
> >> > quotes in the string \" but there must be a better solution then this?
> >> > Cheer Richard
> >> > _______________________________________________
> >> > erlang-questions mailing list
> >> > erlang-questions@REDACTED
> >> > http://erlang.org/mailman/listinfo/erlang-questions
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110607/4cadea85/attachment.htm>


More information about the erlang-questions mailing list