Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
erlang parser for javascript literals
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe Armstrong  
View profile  
 More options Oct 8 2012, 6:07 am
From: Joe Armstrong <erl...@gmail.com>
Date: Mon, 8 Oct 2012 12:06:54 +0200
Local: Mon, Oct 8 2012 6:06 am
Subject: [erlang-questions] erlang parser for javascript literals
Does anybody have an Erlang parser for Javascript literals?

I have some JSON terms - I have to write them like this:

{"id"     : 123,
 "author" : "erl...@gmail.com",
 "title"  : "Some title",
 "type"   : "html",
 "vsns":[{"vsn":1,
          "time":"201200908113012",
          "content":"<h1>This is html</h1>\n<pre>a\nb</pre>"}]

}

But I'd prefer to write them with far fewer quotes and with embedded
line feeds like this:

{id     : 123,
 author : "erl...@gmail.com",
 title  : "Some title",
 type   : html,
 vsns:[{vsn:1,
          time:"201200908113012",
          content:"<h1>This is html</h1>
<pre>a
b
</pre>"}]

}

Or do any of the erlang JSON parsers handle non quoted names in object literals?

/Joe
_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dmitry kolesnikov  
View profile  
 More options Oct 8 2012, 6:42 am
From: dmitry kolesnikov <dmkolesni...@gmail.com>
Date: Mon, 8 Oct 2012 13:41:41 +0300
Local: Mon, Oct 8 2012 6:41 am
Subject: Re: [erlang-questions] erlang parser for javascript literals
Hello Joe,

Object members without quotes is against JSON RFC. If you skip quotes
then this is not JSON any more.

I am using jsx parser, one of the best.
https://github.com/talentdeficit/jsx

Best Regards,
Dmitry >-|-|-*>

On 8.10.2012, at 13.07, Joe Armstrong <erl...@gmail.com> wrote:

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jesper Louis Andersen  
View profile  
 More options Oct 8 2012, 7:22 am
From: Jesper Louis Andersen <jesper.louis.ander...@erlang-solutions.com>
Date: Mon, 8 Oct 2012 13:21:55 +0200
Local: Mon, Oct 8 2012 7:21 am
Subject: Re: [erlang-questions] erlang parser for javascript literals
On Oct 8, 2012, at 12:41 PM, dmitry kolesnikov <dmkolesni...@gmail.com> wrote:

> Hello Joe,

> Object members without quotes is against JSON RFC. If you skip quotes
> then this is not JSON any more.

This is true, but it does not hold you back from choosing another representation format and then converting from that format into proper JSON later when you need to interact with other systems in a correct manner. Raw JSON is quite hard to write due to some of the rules in the dark corners of JS parsing :)

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
José Valim  
View profile  
 More options Oct 8 2012, 7:30 am
From: José Valim <jose.va...@gmail.com>
Date: Mon, 8 Oct 2012 13:29:50 +0200
Local: Mon, Oct 8 2012 7:29 am
Subject: Re: [erlang-questions] erlang parser for javascript literals

> This is true, but it does not hold you back from choosing another
> representation format and then converting from that format into proper JSON
> later when you need to interact with other systems in a correct manner. Raw
> JSON is quite hard to write due to some of the rules in the dark corners of
> JS parsing :)

If you don't want to parse strictly JSON, YAML is an option that will give
you more flexibility than JSON (and the features you asked).

There are some available Erlang wrappers for libyaml, but I haven't used
them personally:

https://github.com/goertzenator/yamler

*
José Valim
* <https://github.com/goertzenator/yamler>*
<https://github.com/goertzenator/yamler>
 <https://github.com/goertzenator/yamler>www.plataformatec.com.br
Founder and Lead Developer
*

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Moritz  
View profile  
 More options Oct 9 2012, 9:11 am
From: Eric Moritz <e...@themoritzfamily.com>
Date: Tue, 9 Oct 2012 09:11:22 -0400
Local: Tues, Oct 9 2012 9:11 am
Subject: Re: [erlang-questions] erlang parser for javascript literals
If you're writing out data structures by hand, YAML is the way to go.

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »