[erlang-questions] mochijson2 decode
Gleb Peregud
gleber.p@REDACTED
Tue Jun 7 15:09:39 CEST 2011
Don't forget to escape quotes:
(test@REDACTED)1> mochijson2:decode( "{ \"colour\" : \"red\",
\"value\" : \"#f00\" }" ).
{struct,[{<<"colour">>,<<"red">>},{<<"value">>,<<"#f00">>}]}
On Tue, Jun 7, 2011 at 15:06, 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
>> >
>> >
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
More information about the erlang-questions
mailing list